通过


SortedList<TKey,TValue>.Clear 方法

定义

从 .. 中删除所有元素SortedList<TKey,TValue>

public:
 virtual void Clear();
public void Clear();
abstract member Clear : unit -> unit
override this.Clear : unit -> unit
Public Sub Clear ()

实现

注解

Count 设置为零,并且还会释放对集合元素中其他对象的引用。

Capacity 保持不变。 若要重置容量 SortedList<TKey,TValue>,请直接调用 TrimExcess 或设置 Capacity 属性。 剪裁空 SortedList<TKey,TValue> 将容量 SortedList<TKey,TValue> 设置为默认容量。

此方法是 O(n) 操作,其中 nCount

适用于

另请参阅