SortedList<TKey, TValue>.Clear Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Removes all elements from the SortedList<TKey, TValue>.

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

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

Capacity remains unchanged. To reset the capacity of the SortedList<TKey, TValue>, call TrimExcess or set the Capacity property directly. Trimming an empty SortedList<TKey, TValue> sets the capacity of the SortedList<TKey, TValue> to the default capacity.

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

Universal Windows Platform
Available since 10
.NET Framework
Available since 2.0
Return to top
Show: