C# LinkedList AddFirst(T)

Description

LinkedList AddFirst(T) adds a new node containing the specified value at the start of the LinkedList .

Syntax

LinkedList.AddFirst(T) has the following syntax.


public LinkedListNode<T> AddFirst(
  T value
)

Parameters

LinkedList.AddFirst(T) has the following parameters.

  • value - The value to add at the start of the LinkedList .

Example


/*  w w w .  j  a v a 2s  . com*/
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" );

   }
}




















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




HashSet
LinkedList
LinkedListNode
List
Queue
SortedSet
Stack