How to remove the first node of LinkedList in C#

1 Answer

0 votes
using System;
using System.Collections.Generic;
                       
public class Program
{
    private static void PrintLinkedList(LinkedList<string> ll) {
        foreach (string word in ll) {
            Console.Write(word + " ");
        }
        Console.WriteLine();
    }
    public static void Main()
    {
        string[] arr =  { "python", "c#", "c", "php", "nodejs", "java", "c", "c++" };
           
        LinkedList<string> ll = new LinkedList<string>(arr);
          
        ll.RemoveFirst(); 
         
        PrintLinkedList(ll);
    }
}
   
 
 
/*
run:
 
c# c php nodejs java c c++
 
*/

 



answered May 7, 2020 by avibootz

Related questions

1 answer 145 views
1 answer 130 views
1 answer 153 views
1 answer 135 views
1 answer 153 views
1 answer 153 views
...