Create a LinkedList from another collection in CSharp

Description

The following code shows how to create a LinkedList from another collection.

Example


using System;/*w w w  . j ava 2  s.c  om*/
using System.Collections.Generic;
public class MainClass{
  public static void Main(String[] argv){  
        string[] words ={ "the", "fox", "jumped", "over", "the", "dog" };
        LinkedList<string> sentence = new LinkedList<string>(words);
        
        foreach(string s in sentence){
            Console.WriteLine(s);
        }

  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Collections »




ArrayList
BitArray
Collection
Comparer
HashSet
Hashtable
LinkedList
List
ListDictionary
OrderedDictionary
Queue
SortedList
SortedSet
Stack
StringCollection
StringDictionary