System.Collections.Generic.SortedList<TKey,TValue>.Clear Method

Removes all elements from the SortedList`2.

Syntax

public void Clear ()

Remarks

SortedList`2.Count is set to zero, and references to other objects from elements of the collection are also released.

SortedList`2.Capacity remains unchanged. To reset the capacity of the SortedList`2, call SortedList`2.TrimExcess or set the SortedList`2.Capacity property directly. Trimming an empty SortedList`2 sets the capacity of the SortedList`2 to the default capacity.

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

Requirements

Namespace: System.Collections.Generic
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0