LinkedList<T>.Contains(T) 方法

定义

确定某值是否在 LinkedList<T> 中。Determines whether a value is in the LinkedList<T>.

public:
 virtual bool Contains(T value);
public bool Contains (T value);
abstract member Contains : 'T -> bool
override this.Contains : 'T -> bool
Public Function Contains (value As T) As Boolean

参数

value
T

要在 LinkedList<T> 中定位的值。The value to locate in the LinkedList<T>. 对于引用类型,该值可以为 nullThe value can be null for reference types.

返回

Boolean

如果在 true 中找到 value,则为 LinkedList<T>;否则为 falsetrue if value is found in the LinkedList<T>; otherwise, false.

实现

示例

有关包括此方法的示例,请参阅 LinkedList<T> 类。For an example that includes this method, see the LinkedList<T> class.

注解

此方法执行线性搜索;因此,此方法是 O (n) 操作,其中 nCountThis method performs a linear search; therefore, this method is an O(n) operation, where n is Count.

适用于

另请参阅