コード例 #1
0
        static void Main(string[] args)
        {
            Node node = new Node(10);

            node.next           = new Node(2);
            node.next.next      = new Node(14);
            node.next.next.next = new Node(5);
            node.Print();
            Console.ReadKey();
        }
コード例 #2
0
 public void Print()
 {
     if (next != null)
     {
         Console.Write(" | " + data + " | " + "->");
         next.Print();
     }
     else
     {
         Console.WriteLine(" | " + data + " | ");
     }
 }
コード例 #3
0
 public void Print()
 {
     if (headNode != null)
     {
         headNode.Print();
     }
     else
     {
         Console.Write("Empty LinkedList!");
     }
     Console.WriteLine();
 }
コード例 #4
0
 public void Print()
 {
     if (next != null)
     {
         Console.Write(data + ",");
         if (next != null)
         {
             next.Print();
         }
     }
     else
     {
         Console.Write(data);
     }
 }
コード例 #5
0
        static void Main(string[] args)
        {
            //creates a new Node with a head value of 7
            Node myNode = new Node(7);

            // adds a new node in myNode by updating Nodes pointer value and creating a new node with the new data and new pointer

            // this is not scalable
            myNode.next = new Node(5);
            //better way is to use the new method AddToEnd
            myNode.AddToEnd(12);
            myNode.AddToEnd(15);
            // call print method
            myNode.Print();
        }
コード例 #6
0
 public void Print()
 {
     _headNode?.Print();
 }