LinkedList<T>.Find(T) 方法

定义

查找包含指定值的第一个节点。Finds the first node that contains the specified value.

public:
 System::Collections::Generic::LinkedListNode<T> ^ Find(T value);
public System.Collections.Generic.LinkedListNode<T> Find (T value);
public System.Collections.Generic.LinkedListNode<T>? Find (T value);
member this.Find : 'T -> System.Collections.Generic.LinkedListNode<'T>
Public Function Find (value As T) As LinkedListNode(Of T)

参数

value
T

要在 LinkedList<T> 中定位的值。The value to locate in the LinkedList<T>.

返回

LinkedListNode<T>

如果找到,则为包含指定值的第一个 LinkedListNode<T>;否则为 nullThe first LinkedListNode<T> that contains the specified value, if found; otherwise, null.

示例

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

注解

在中 LinkedList<T> 向前搜索,从开始 First ,到结束 LastThe LinkedList<T> is searched forward starting at First and ending at Last.

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

适用于

另请参阅