NameObjectCollectionBase.Count 屬性

定義

取得 NameObjectCollectionBase 執行個體中包含的索引鍵/值組數目。Gets the number of key/value pairs contained in the NameObjectCollectionBase instance.

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

屬性值

Int32

NameObjectCollectionBase 執行個體中包含的索引鍵/值組數目。The number of key/value pairs contained in the NameObjectCollectionBase instance.

實作

備註

容量是可儲存的元素數目 NameObjectCollectionBaseThe capacity is the number of elements that the NameObjectCollectionBase can store. Count 這是實際在中的元素數目 NameObjectCollectionBaseCount is the number of elements that are actually in the NameObjectCollectionBase.

容量一律大於或等於 CountThe capacity is always greater than or equal to Count. 如果在 Count 加入專案時超過容量,則在複製舊專案並新增新專案之前,會重新配置內部陣列,以自動增加容量。If Count exceeds the 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.

適用於