HashSet<T>.Clear Method

Removes all elements from a HashSet<T> object.

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

Syntax

'Declaration
Public Sub Clear
public void Clear()

Implements

ICollection<T>.Clear()

Remarks

Count is set to zero and references to other objects from elements of the collection are also released. The capacity remains unchanged until a call to TrimExcess is made.

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

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.