Dictionary<TKey,TValue>.Count Dictionary<TKey,TValue>.Count Dictionary<TKey,TValue>.Count Dictionary<TKey,TValue>.Count Property

定義

取得 Dictionary<TKey,TValue> 中所包含的索引鍵/值組數目。Gets the number of key/value pairs contained in the Dictionary<TKey,TValue>.

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

屬性值

Dictionary<TKey,TValue> 中所包含的索引鍵/值組數目。The number of key/value pairs contained in the Dictionary<TKey,TValue>.

實作

備註

的容量Dictionary<TKey,TValue>Dictionary<TKey,TValue>可儲存的元素數目。The capacity of a Dictionary<TKey,TValue> is the number of elements that the Dictionary<TKey,TValue> can store. 屬性是實際Dictionary<TKey,TValue>在中的元素數目。 CountThe Count property is the number of elements that are actually in the Dictionary<TKey,TValue>.

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

適用於