SortedList<TKey,TValue>.Count 属性

定义

获取包含在 SortedList<TKey,TValue> 中的键/值对的数目。

public:
 property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer

属性值

Int32

包含在 SortedList<TKey,TValue> 中的键/值对的数目。

实现

注解

Capacity 是可以存储的 SortedList<TKey,TValue> 元素数。 Count 是实际位于的 SortedList<TKey,TValue>元素数。

Capacity 始终大于或等于 Count。 如果在 Count 添加元素时超出, Capacity 则通过自动重新分配内部数组来增加容量,然后再复制旧元素并添加新元素。

检索此属性的值的运算复杂度为 O(1)。

适用于

另请参阅