SortedDictionary<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>使用 ,而 SortedDictionary<TKey,TValue> 可讓使用者指定用來比較索引鍵的IComparer<T>Default作。

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

適用於