Dictionary<TKey,TValue>.ValueCollection.ICollection<TValue>.Contains 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
确定是否 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) 操作,其中 n 。Count