Collection<T>.IList.Contains(Object) 方法

定義

判斷 IList 是否包含特定值。

 virtual bool System.Collections.IList.Contains(System::Object ^ value) = System::Collections::IList::Contains;
bool IList.Contains (object value);
abstract member System.Collections.IList.Contains : obj -> bool
override this.System.Collections.IList.Contains : obj -> bool
Function Contains (value As Object) As Boolean Implements IList.Contains

參數

value
Object

要在 IList 中尋找的 Object

傳回

Boolean

如果在 IList 中找到 Object,則為 true,否則為 false

實作

例外狀況

value 所屬類型無法指派給 IList

備註

這個方法會先判斷 類型 T 為 (或 null) ,然後呼叫 Contains ,以判斷 value 是否相等。

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

適用於