Dictionary<TKey,TValue>.KeyCollection.ICollection<TKey>.Contains Metod

Definition

Avgör om innehåller ICollection<T> ett specifikt värde.

 virtual bool System.Collections.Generic.ICollection<TKey>.Contains(TKey item) = System::Collections::Generic::ICollection<TKey>::Contains;
bool ICollection<TKey>.Contains(TKey item);
abstract member System.Collections.Generic.ICollection<TKey>.Contains : 'Key -> bool
override this.System.Collections.Generic.ICollection<TKey>.Contains : 'Key -> bool
Function Contains (item As TKey) As Boolean Implements ICollection(Of TKey).Contains

Parametrar

item
TKey

Objektet som ska hittas ICollection<T>i .

Returer

trueom item hittas i ICollection<T>; annars . false

Implementeringar

Kommentarer

Implementeringar kan variera i hur de bestämmer objektens likhet. använder List<T>till Default exempel , medan Dictionary<TKey,TValue> tillåter användaren att ange vilken implementering som IComparer<T> ska användas för att jämföra nycklar.

Den här metoden är en O(1)-åtgärd.

Gäller för