HashSet<T>.Clear Method

Removes all elements from a HashSet<T> object.

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

public void Clear()

Implements

ICollection<T>.Clear()

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.

Silverlight

Supported in: 5, 4

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

Community Additions

ADD
Show: