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

Definition

Determines whether the ICollection<T> contains a specific value.

 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

Parameters

item
TKey

The object to locate in the ICollection<T>.

Returns

true if item is found in the ICollection<T>; otherwise, false.

Implements

Remarks

Implementations can vary in how they determine equality of objects; for example, List<T> uses Default, whereas, Dictionary<TKey,TValue> allows the user to specify the IComparer<T> implementation to use for comparing keys.

This method is an O(1) operation.

Applies to