SortedDictionary<TKey,TValue>.KeyCollection.ICollection<TKey>.Contains 方法

定義

判斷 ICollection<T> 是否包含指定的值。

 virtual bool System.Collections.Generic.ICollection<TKey>.Contains(TKey item) = System::Collections::Generic::ICollection<TKey>::Contains;
bool ICollection<TKey>.Contains (TKey item);
abstract member System.Collections.Generic.ICollection<TKey>.Contains : 'Key -> bool
override this.System.Collections.Generic.ICollection<TKey>.Contains : 'Key -> bool
Function Contains (item As TKey) As Boolean Implements ICollection(Of TKey).Contains

參數

item
TKey

要在 ICollection<T> 中尋找的物件。

傳回

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

實作

備註

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

這個方法是 O (1) 作業。

適用於