Lookup<TKey,TElement>.Contains(TKey) Yöntem

Tanım

Belirtilen anahtarın içinde Lookup<TKey,TElement>olup olmadığını belirler.

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

Parametreler

key
TKey

içinde Lookup<TKey,TElement>bulunacak anahtar.

Döndürülenler

true içindeyse keyLookup<TKey,TElement>; değilse, false.

Uygulamalar

Örnekler

Aşağıdaki örnek, bir anahtarın belirli bir anahtar içerip içermediğini Lookup<TKey,TElement> belirlemek için nasıl kullanılacağını Contains gösterir. Bu kod örneği, sınıfı için Lookup<TKey,TElement> sağlanan daha büyük bir örneğin parçasıdır.

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

Şunlara uygulanır