C# LinkedList AddAfter(LinkedListNode, LinkedListNode)
Description
LinkedList
adds the specified new node after the specified
existing node in the LinkedList
Syntax
public void AddAfter(
LinkedListNode<T> node,
LinkedListNode<T> newNode
)
Parameters
node
- The LinkedListNodeafter which to insert newNode. newNode
- The new LinkedListNodeto add to the LinkedList .
Example
/* w w w .j a v a 2s. co m*/
using System;
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,ll.Last );
}
}