ReadOnlyCollection<T>.IList.Contains(Object) ReadOnlyCollection<T>.IList.Contains(Object) ReadOnlyCollection<T>.IList.Contains(Object) Method

定義

判斷 IList 是否包含特定值。Determines whether the IList contains a specific value.

 virtual bool System.Collections.IList.Contains(System::Object ^ value) = System::Collections::IList::Contains;
bool IList.Contains (object value);
Function Contains (value As Object) As Boolean Implements IList.Contains

參數

value
Object Object Object

要在 IList 中尋找的 ObjectThe Object to locate in the IList.

傳回

如果在 IList 中找到 Object,則為 true,否則為 falsetrue if the Object is found in the IList; otherwise, false.

實作

例外狀況

value 之型別不是為泛型型別參數 T 所指定的型別。value is not of the type specified for the generic type parameter T.

備註

這個方法會使用預設的比較EqualityComparer<T>.Default子來判斷是否相等。This method determines equality using the default comparer EqualityComparer<T>.Default.

這個方法會執行線性搜尋;因此, 這個方法是 O (n) 運算, 其中nCountThis method performs a linear search; therefore, this method is an O(n) operation, where n is Count.

這個成員是明確介面成員實作,This member is an explicit interface member implementation. 只有在 ReadOnlyCollection<T> 執行個體轉換成 IList 介面時,才能使用這個成員。It can be used only when the ReadOnlyCollection<T> instance is cast to an IList interface.

適用於