Dictionary<TKey,TValue>.ValueCollection.ICollection<TValue>.Contains 方法

定义

确定是否 ICollection<T> 包含特定值。

 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

参数

item
TValue

要定位在 . 中的 ICollection<T>对象

返回

如果在 /> 中找到,则为 ;否则为 >。

实现

注解

实现在确定对象相等性的方式上可能有所不同;例如, List<T> 使用 Default,而 Dictionary<TKey,TValue> 允许用户指定 IComparer<T> 用于比较键的实现。

此方法是 O(n) 操作,其中 nCount

适用于