LinkedList<T>.Insert method (1 of 2)

Adds a new value at the specified position.

public void Insert(int index, T value)
parameter description
index The zero-based index at which value should be inserted.
value New value to insert.

Exceptions

exception condition
ArgumentOutOfRangeException Thrown if index is less than zero or greater than the size of the list.

See Also


LinkedList<T>.Insert method (2 of 2)

Adds a new value before or after the passed in position.

public void Insert(Node<T> node, T value, bool insertBefore = false)
parameter description
node Insertion point.
value New value to add.
insertBefore True to insert before node, False to insert after. Default is after (False)

Exceptions

exception condition
ArgumentNullException Thrown if node is null.

See Also