SortedList.Count 屬性

定義

取得 SortedList 物件中所包含的元素數目。

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

屬性值

SortedList 物件中所包含的元素數目。

實作

備註

每個元素都是可做為 DictionaryEntry 物件的索引鍵/值組。

Capacity 是物件可以儲存的元素 SortedList 數目。 Count 是實際在中的 SortedList項目數目。

Capacity 一律大於或等於 Count。 如果 Count 新增元素時超過 Capacity ,則會先重新配置內部數位,再複製舊元素並新增新元素,以自動增加容量。

擷取這個屬性的值是 O(1) 作業。

適用於

另請參閱