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

Removes all elements from the SortedList`2.


public void Clear ()


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.


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