Skip to main content
Tab

Collection<T>.RemoveAll(Predicate<T>) Method

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

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public void RemoveAll(
    Predicate<T> match
)

Parameters

Name Type Description
match Predicate<T>

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

Remarks

The RemoveAll method individually passes elements of the current 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 you can use the RemoveAll method to remove items from a collection based on custom conditions. In this example, any CloudControlItem, whose value is less then the value specified via the ASPxSpinEdit, is removed on a button click.

using DevExpress.Web.ASPxCloudControl;
...
protected void btn_RemoveItems_Click(object sender, EventArgs e) {
     ASPxCloudControl1.Items.RemoveAll(IsLess);
}
public bool IsLess(CloudControlItem Item) {
     var MinValue = ASPxSpinEdit1.Number;
     return (decimal)Item.Value < MinValue;
}
See Also