SortedList<TKey,TValue>.Count 属性

定义

获取包含在 SortedList<TKey,TValue> 中的键/值对的数目。Gets the number of key/value pairs contained in the SortedList<TKey,TValue>.

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

属性值

包含在 SortedList<TKey,TValue> 中的键/值对的数目。The number of key/value pairs contained in the SortedList<TKey,TValue>.

实现

注解

CapacitySortedList<TKey,TValue>可以存储的元素数。Capacity is the number of elements that the SortedList<TKey,TValue> can store. Count实际在中SortedList<TKey,TValue>的元素的数目。Count is the number of elements that are actually in the SortedList<TKey,TValue>.

Capacity始终大于或等于CountCapacity is always greater than or equal to Count. 如果CountCapacity添加元素时超过,则会在复制旧元素并添加新元素之前自动重新分配内部数组,从而增加容量。If Count exceeds Capacity while adding elements, the capacity is increased by automatically reallocating the internal array before copying the old elements and adding the new elements.

检索此属性的值的运算复杂度为 O(1)。Retrieving the value of this property is an O(1) operation.

适用于

另请参阅