LinkedList<T>.AddFirst Método

Definição

Adiciona um novo nó ou valor ao início do LinkedList<T>.Adds a new node or value at the start of the LinkedList<T>.

Sobrecargas

AddFirst(LinkedListNode<T>)

Adiciona o novo nó especificado ao início do LinkedList<T>.Adds the specified new node at the start of the LinkedList<T>.

AddFirst(T)

Adiciona um novo nó que contém o valor especificado no início da LinkedList<T>.Adds a new node containing the specified value at the start of the LinkedList<T>.

AddFirst(LinkedListNode<T>)

Adiciona o novo nó especificado ao início do LinkedList<T>.Adds the specified new node at the start of the LinkedList<T>.

public:
 void AddFirst(System::Collections::Generic::LinkedListNode<T> ^ node);
public void AddFirst (System.Collections.Generic.LinkedListNode<T> node);
member this.AddFirst : System.Collections.Generic.LinkedListNode<'T> -> unit
Public Sub AddFirst (node As LinkedListNode(Of T))

Parâmetros

node
LinkedListNode<T>

O novo LinkedListNode<T> a ser adicionado ao início do LinkedList<T>.The new LinkedListNode<T> to add at the start of the LinkedList<T>.

Exceções

node é null.node is null.

node pertence a outro LinkedList<T>.node belongs to another LinkedList<T>.

Exemplos

Para obter um exemplo que inclua esse método, consulte a classe LinkedList<T>.For an example that includes this method, see the LinkedList<T> class.

Comentários

LinkedList<T> aceita null como um válido Value para tipos de referência e permite valores duplicados.LinkedList<T> accepts null as a valid Value for reference types and allows duplicate values.

Caso LinkedList<T> esteja vazio, o novo nó transforma-se no First e no Last.If the LinkedList<T> is empty, the new node becomes the First and the Last.

Este método é uma operação O(1).This method is an O(1) operation.

Confira também

Aplica-se a

AddFirst(T)

Adiciona um novo nó que contém o valor especificado no início da LinkedList<T>.Adds a new node containing the specified value at the start of the LinkedList<T>.

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

Parâmetros

value
T

O valor a ser adicionado no início da LinkedList<T>.The value to add at the start of the LinkedList<T>.

Retornos

LinkedListNode<T>

O novo LinkedListNode<T> que contém value.The new LinkedListNode<T> containing value.

Exemplos

Para obter um exemplo que inclua esse método, consulte a classe LinkedList<T>.For an example that includes this method, see the LinkedList<T> class.

Comentários

LinkedList<T> aceita null como um válido Value para tipos de referência e permite valores duplicados.LinkedList<T> accepts null as a valid Value for reference types and allows duplicate values.

Caso LinkedList<T> esteja vazio, o novo nó transforma-se no First e no Last.If the LinkedList<T> is empty, the new node becomes the First and the Last.

Este método é uma operação O(1).This method is an O(1) operation.

Confira também

Aplica-se a