Skip to main content
Tab

HierarchicalCollection<T>.RemoveAllRecursive(Predicate<T>) Method

Removes all items that match the conditions defined by the specified predicate from the hierarchical collection.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public void RemoveAllRecursive(
    Predicate<T> match
)

Parameters

Name Type Description
match Predicate<T>

A delegate that defines the conditions of the elements to remove.

Remarks

The RemoveAllRecursive method individually passes elements of the current hierarchical collection to a predicate, and removes elements that match the predicate. A predicate is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate; otherwise the method returns false.

Example

The code sample below demonstrates how to remove checked nodes using the RemoveAllRecursive method. The IsChecked predicate determines whether a node is checked.

using DevExpress.Web.ASPxTreeView;
...
protected void btn_RemoveCheckedNodes_Click(object sender, EventArgs e) {
     ASPxTreeView1.Nodes.RemoveAllRecursive(IsChecked);
}
private static bool IsChecked(TreeViewNode node) {
     return node.Checked;
}
See Also