Lookup<TKey,TElement>.Contains(TKey) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Avgör om en angiven nyckel finns i 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
Parametrar
- key
- TKey
Nyckeln som ska hittas Lookup<TKey,TElement>i .
Returer
true if key is in the Lookup<TKey,TElement>;wise, false.
Implementeringar
Exempel
I följande exempel visas hur du använder Contains för att avgöra om en Lookup<TKey,TElement> innehåller en angiven nyckel. Det här kodexemplet är en del av ett större exempel för Lookup<TKey,TElement> klassen.
// 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)