SortedList.Count 属性

定义

获取 SortedList 对象中包含的元素数。Gets the number of elements contained in a SortedList object.

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

属性值

SortedList 对象中包含的元素数。The number of elements contained in the SortedList object.

实现

注解

每个元素都是一个键/值对,可作为 DictionaryEntry 对象进行访问。Each element is a key/value pair that can be accessed as a DictionaryEntry object.

CapacitySortedList 对象可存储的元素数。Capacity is the number of elements that the SortedList object can store. Count 是实际处于 SortedList中的元素的数目。Count is the number of elements that are actually in the SortedList.

Capacity 始终大于或等于 CountCapacity is always greater than or equal to Count. 如果在添加元素时 Count 超过 Capacity,则在复制旧元素并添加新元素之前,重新分配内部数组,将自动增加容量。If Count exceeds Capacity while adding elements, the capacity is automatically increased by 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.

适用于

另请参阅