Lookup<TKey,TElement>.Count 屬性

定義

取得 Lookup<TKey,TElement> 中的索引鍵/值集合組數目。

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

屬性值

Lookup<TKey,TElement> 集合中的索引鍵/值集合組數目。

實作

範例

下列範例示範如何使用 Count 來判斷 中的 Lookup<TKey,TElement> 索引鍵/值集合組數目。 此程式碼範例是提供給 類別之較大範例的 Lookup<TKey,TElement> 一部分。

// Get the number of key-collection pairs in the Lookup.
int count = lookup.Count;
' Get the number of key-collection pairs in the Lookup.
Dim count As Integer = lookup.Count

備註

屬性的值 Count 不會變更,因為專案在建立之後無法加入物件或從 Lookup<TKey,TElement> 物件中移除。

適用於