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> 项。

适用于