Lookup<TKey,TElement>.Contains(TKey) Methode

Definition

Bestimmt, ob sich ein angegebener Schlüssel in der Lookup<TKey,TElement>.

public:
 virtual bool Contains(TKey key);
public bool Contains(TKey key);
abstract member Contains : 'Key -> bool
override this.Contains : 'Key -> bool
Public Function Contains (key As TKey) As Boolean

Parameter

key
TKey

Der Schlüssel, der in der Datei zu finden ist Lookup<TKey,TElement>.

Gibt zurück

true if key is in the Lookup<TKey,TElement>; otherwise, false.

Implementiert

Beispiele

Im folgenden Beispiel wird veranschaulicht, wie sie verwenden können, Contains um zu bestimmen, ob ein Lookup<TKey,TElement> angegebener Schlüssel enthalten ist. Dieses Codebeispiel ist Teil eines größeren Beispiels, das für die Lookup<TKey,TElement> Klasse bereitgestellt wird.

// Determine if there is a key with the value 'G' in the Lookup.
bool hasG = lookup.Contains('G');
' Determine if there is a key with the value 'G' in the Lookup.
Dim hasG As Boolean = lookup.Contains("G"c)

Gilt für: