Breyta

Deila með


LinkedList<T>.AddBefore Method

Definition

Adds a new node or value before an existing node in the LinkedList<T>.

Overloads

AddBefore(LinkedListNode<T>, LinkedListNode<T>)

Adds the specified new node before the specified existing node in the LinkedList<T>.

AddBefore(LinkedListNode<T>, T)

Adds a new node containing the specified value before the specified existing node in the LinkedList<T>.

AddBefore(LinkedListNode<T>, LinkedListNode<T>)

Source:
LinkedList.cs
Source:
LinkedList.cs
Source:
LinkedList.cs

Adds the specified new node before the specified existing node in the LinkedList<T>.

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

Parameters

node
LinkedListNode<T>

The LinkedListNode<T> before which to insert newNode.

newNode
LinkedListNode<T>

The new LinkedListNode<T> to add to the LinkedList<T>.

Exceptions

node is null.

-or-

newNode is null.

node is not in the current LinkedList<T>.

-or-

newNode belongs to another LinkedList<T>.

Examples

For an example that includes this method, see the LinkedList<T> class.

Remarks

LinkedList<T> accepts null as a valid Value for reference types and allows duplicate values.

This method is an O(1) operation.

See also

Applies to

AddBefore(LinkedListNode<T>, T)

Source:
LinkedList.cs
Source:
LinkedList.cs
Source:
LinkedList.cs

Adds a new node containing the specified value before the specified existing node in the LinkedList<T>.

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

Parameters

node
LinkedListNode<T>

The LinkedListNode<T> before which to insert a new LinkedListNode<T> containing value.

value
T

The value to add to the LinkedList<T>.

Returns

The new LinkedListNode<T> containing value.

Exceptions

node is null.

node is not in the current LinkedList<T>.

Examples

For an example that includes this method, see the LinkedList<T> class.

Remarks

LinkedList<T> accepts null as a valid Value for reference types and allows duplicate values.

This method is an O(1) operation.

See also

Applies to