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> 中尋找的物件。

傳回

如果在 true 中找到 item,則為 ICollection<T>,否則為 false

實作

備註

實作依判斷物件相等的方法會有所不同;例如,List<T> 使用 Default,而 Dictionary<TKey,TValue> 則讓使用者指定要用來比較索引鍵的 IComparer<T> 實作。

這個方法是 O (n) 作業,其中 nCount

適用於