C# LinkedList AddAfter(LinkedListNode, T)
Description
LinkedList
adds
a new node containing the specified value after the specified existing node
in the LinkedList
Syntax
public LinkedListNode<T> AddAfter(
LinkedListNode<T> node,
T value
)
Parameters
node
- The LinkedListNodeafter which to insert a new LinkedListNode containing value. value
- The value to add to the LinkedList.
Example
using System;//from w ww . j a v a 2s. c o m
using System.Collections;
using System.Collections.Generic;
public class GenericCollection
{
public static void Main()
{
LinkedList<String> ll = new LinkedList<String>();
ll.AddLast("A");
ll.AddLast("B");
ll.AddLast("C");
ll.AddLast("java2s.com");
ll.AddAfter(ll.First,"A");
}
}