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

定義

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

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

參數

item
Object Object Object

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

傳回

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

實作

備註

這個方法會判斷使用的預設相等比較子的相等EqualityComparer<T>.Default針對T,清單中值的類型。This method determines equality using the default equality comparer EqualityComparer<T>.Default for T, the type of values in the list.

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

適用於