C# LinkedList Remove(T)

Description

LinkedList Remove(T) removes the first occurrence of the specified value from the LinkedList .

Syntax

LinkedList.Remove(T) has the following syntax.


public bool Remove(
  T value
)

Parameters

LinkedList.Remove(T) has the following parameters.

  • value - The value to remove from the LinkedList .

Returns

LinkedList.Remove(T) method returns true if the element containing value is successfully removed; otherwise, false. This method also returns false if value was not found in the original LinkedList.

Example


using System;//from w ww.j  av  a2s .com
using System.Collections;
using System.Collections.Generic;

public class GenericCollection  
{
   public static void Main()  
   {
      LinkedList<String> ll = new LinkedList<String>();
      ll.AddLast( "A" );
      ll.AddLast( "B" );
      ll.AddLast( "C" );
      ll.AddLast( "java2s.com" );
      
      ll.Remove("A");
      
   }
}




















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




HashSet
LinkedList
LinkedListNode
List
Queue
SortedSet
Stack