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.