Redigera

Dela via


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

Definition

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);
abstract member System.Collections.IList.Contains : obj -> bool
override this.System.Collections.IList.Contains : obj -> bool
Function Contains (item As Object) As Boolean Implements IList.Contains

Parameters

item
Object

The Object to locate in the IList.

Returns

true if item is found in the IList; otherwise, false.

Implements

Remarks

This method determines equality using the default equality comparer EqualityComparer<T>.Default for T, the type of values in the list.

This method performs a linear search; therefore, this method is an O(n) operation, where n is Count.

Applies to