Mono Class Library: System.Collections.Generic.List<T> Overview | Members

System.Collections.Generic.List<T>.RemoveAll Method

Removes the all the elements that match the conditions defined by the specified predicate.

public int RemoveAll (Predicate<T> match)

Parameters

match
The predicate delegate that specifies the elements to remove.

Returns

The number of elements removed from the List.

Exceptions

TypeReason
ArgumentNullExceptionmatch is null.

Remarks

The predicate is a delegate that returns true if the object passed to it matches the conditions defined in the delegate. The elements of the current List are individually passed to the predicate delegate, and the elements that match the conditions are removed from the List.

This method is an O(n) operation, where n is List<T>.Count.

Requirements

Namespace: System.Collections.Generic
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0