HashSet<T>.Remove Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Function Remove ( _
    item As T _
) As Boolean
public bool Remove(
    T item
)

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.

Implements

ICollection<T>.Remove(T)

Remarks

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.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.