Collection<T>.IList.Contains(Object) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
判斷 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
參數
傳回
如果在 IList 中找到 Object,則為 true,否則為 false。
實作
例外狀況
value 所屬類型無法指派給 IList。
備註
這個方法會先判斷 類型T為 (或 null) ,然後呼叫 Contains,以判斷value是否相等。
這個方法是 O (n) 作業,其中 n 是 Count。