Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SortedList<TKey, TValue>::Clear Method ()

 

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

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

public:
virtual void Clear() sealed

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:
© 2017 Microsoft