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>::Remove Method (T)

 

Removes the specified element from a HashSet<T> object.

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

public:
virtual bool Remove(
	T item
) sealed

Parameters

item
Type: T

The element to remove.

Return Value

Type: System::Boolean

true if the element is successfully found and removed; otherwise, false. This method returns false if item is not found in the HashSet<T> object.

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.

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