HashSet<T>::Remove Method (T)
Removes the specified element from a HashSet<T> object.
Assembly: System.Core (in System.Core.dll)
Parameters
- item
-
Type:
T
The element to remove.
Return Value
Type: System::Booleantrue if the element is successfully found and removed; otherwise, false. This method returns false if item is not found in the HashSet<T> object.
Implements
ICollection<T>::Remove(T)If the HashSet<T> object does not contain the specified element, the object remains unchanged. No exception is thrown.
This method is an O(1) operation.
The following example demonstrates how to remove values from a HashSet<T> collection using the Remove method. In this example, zero is arbitrarily removed from the HashSet<T> collection.
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