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

Definition

Avgör om innehåller ICollection<T> det angivna värdet.

 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

true om objektet hittas i ICollection<T>, annars , false.

Implementeringar

Kommentarer

Implementeringar kan variera i hur de bestämmer objektens likhet. använder Defaulttill exempel List<T> , medan SortedDictionary<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