C# LinkedList Contains

Description

LinkedList Contains determines whether a value is in the LinkedList .

Syntax

LinkedList.Contains has the following syntax.


public bool Contains(
  T value
)

Parameters

LinkedList.Contains has the following parameters.

  • value - The value to locate in the LinkedList . The value can be null for reference types.

Returns

LinkedList.Contains method returns true if value is found in the LinkedList; otherwise, false.

Example


using System;//  w w  w  . j a  v  a 2 s.  c  om
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" );

      Console.WriteLine(ll.Contains("A"));

   }
}

The code above generates the following result.





















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




HashSet
LinkedList
LinkedListNode
List
Queue
SortedSet
Stack