Redigera

Dela via


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

Definition

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

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

Parameters

item
TValue

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(n) operation, where n is Count.

Applies to