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

定义

确定 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 中查找的 IListThe 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.

适用于