Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HashSet<T>::RemoveWhere Method (Predicate<T>^)

 

Removes all elements that match the conditions defined by the specified predicate from a HashSet<T> collection.

Namespace:   System.Collections.Generic
Assembly:  System.Core (in System.Core.dll)

public:
int RemoveWhere(
	Predicate<T>^ match
)

Parameters

match
Type: System::Predicate<T>^

The Predicate<T> delegate that defines the conditions of the elements to remove.

Return Value

Type: System::Int32

The number of elements that were removed from the HashSet<T> collection.

Exception Condition
ArgumentNullException

match is null.

Calling this method is an O(n) operation, where n is Count.

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.

No code example is currently available or this language may not be supported.

Universal Windows Platform
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
Return to top
Show:
© 2017 Microsoft