HashSet<T>::RemoveWhere Method (Predicate<T>^)
Removes all elements that match the conditions defined by the specified predicate from a HashSet<T> collection.
Assembly: System.Core (in System.Core.dll)
Parameters
- match
-
Type:
System::Predicate<T>^
The Predicate<T> delegate that defines the conditions of the elements to remove.
Return Value
Type: System::Int32The number of elements that were removed from the HashSet<T> collection.
| Exception | Condition |
|---|---|
| ArgumentNullException | match is null. |
The following example demonstrates how to remove values from a HashSet<T> collection using the Remove method. In this example, all odd integers are removed from the HashSet<T> collection as specified by the match delegate.
Available since 8
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1