Add value at the start of the LinkedList in CSharp
Description
The following code shows how to add value at the start of the LinkedList.
Example
//www . j a v a2 s. c o m
using System;
using System.Collections;
using System.Collections.Generic;
public class GenericCollection
{
public static void Main()
{
LinkedList<String> ll = new LinkedList<String>();
ll.AddFirst( "A" );
ll.AddFirst( "B" );
ll.AddFirst( "C" );
ll.AddFirst( "java2s.com" );
foreach(string s in ll){
Console.WriteLine(s);
}
}
}
The code above generates the following result.