C# LinkedList LinkedList(IEnumerable)

Description

LinkedList LinkedList (IEnumerable ) initializes a new instance of the LinkedList class that contains elements copied from the specified IEnumerable and has sufficient capacity to accommodate the number of elements copied.

Syntax


public LinkedList(
  IEnumerable<T> collection
)

Parameters

  • collection - The IEnumerable whose elements are copied to the new LinkedList .

Example


using System;//  w  w  w.  ja va2 s.  c o  m
using System.Collections.Generic;
public class MainClass{
  public static void Main(String[] argv){  

        // Create the link list. 
        string[] words =
            { "the", "fox", "jumped", "over", "the", "dog" };
        LinkedList<string> sentence = new LinkedList<string>(words);

  }
}




















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




HashSet
LinkedList
LinkedListNode
List
Queue
SortedSet
Stack