Lookup<TKey,TElement>.Count Property

Definition

Gets the number of key/value collection pairs in the Lookup<TKey,TElement>.

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

Property Value

The number of key/value collection pairs in the Lookup<TKey,TElement>.

Implements

Examples

The following example demonstrates how to use Count to determine the number of key/value collection pairs in a Lookup<TKey,TElement>. This code example is part of a larger example provided for the Lookup<TKey,TElement> class.

// 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

Remarks

The value of the Count property does not change because items cannot be added to or removed from a Lookup<TKey,TElement> object after it has been created.

Applies to