SortedDictionary<TKey,TValue>.ValueCollection.ICollection<TValue>.Contains(TValue) 方法

定义

确定 ICollection<T> 是否包含指定值。Determines whether the ICollection<T> contains a specified value.

 virtual bool System.Collections.Generic.ICollection<TValue>.Contains(TValue item) = System::Collections::Generic::ICollection<TValue>::Contains;
bool ICollection<TValue>.Contains (TValue item);
Function Contains (item As TValue) As Boolean Implements ICollection(Of TValue).Contains

参数

item
TValue

要在 ICollection<T> 中定位的对象。The object to locate in the ICollection<T>.

返回

如果在 true 中找到 item,则为 ICollection<T>;否则为 falsetrue if item is found in the ICollection<T>; otherwise, false.

实现

注解

实现在确定对象的相等性方面可能有所不同;例如,List<T> 使用 Default,而 SortedDictionary<TKey,TValue> 允许用户指定要用于比较键的 @no__t 3 实现。Implementations can vary in how they determine equality of objects; for example, List<T> uses Default, whereas SortedDictionary<TKey,TValue> allows the user to specify the IComparer<T> implementation to use for comparing keys.

此方法的运算复杂度为 O (n),其中 n CountThis method is an O(n) operation, where n is Count.

适用于