C# LinkedListNode Next

Description

LinkedListNode Next gets the next node in the LinkedList .

Syntax

LinkedListNode.Next has the following syntax.


public LinkedListNode<T> Next { get; }

Example


using System;/*from   w ww .  j av  a  2  s. c o m*/
using System.Collections.Generic;

public class GenericCollection  {

   public static void Main()  {
      LinkedListNode<String> lln = new LinkedListNode<String>( "Java" );
      DisplayProperties( lln );
      LinkedList<String> ll = new LinkedList<String>();

      ll.AddLast( lln );
      DisplayProperties( lln );

      ll.AddFirst( "XML" );
      ll.AddLast( "HTML" );
      DisplayProperties( lln );
   }
   public static void DisplayProperties( LinkedListNode<String> lln )  {

      if ( lln.Next == null )
         Console.WriteLine("Next node is null." );
      else
         Console.WriteLine("Value of next node:     {0}", lln.Next.Value );
   }

}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections.Generic »




HashSet
LinkedList
LinkedListNode
List
Queue
SortedSet
Stack