C# ListDictionary Contains

Description

ListDictionary Contains determines whether the ListDictionary contains a specific key.

Syntax

ListDictionary.Contains has the following syntax.


public bool Contains(
  Object key
)

Parameters

ListDictionary.Contains has the following parameters.

  • key - The key to locate in the ListDictionary.

Returns

ListDictionary.Contains method returns true if the ListDictionary contains an entry with the specified key; otherwise, false.

Example


using System;//from  ww w .ja va 2s . c  o  m
using System.Collections;
using System.Collections.Specialized;

public class SamplesListDictionary  {
   public static void Main()  {
      ListDictionary myCol = new ListDictionary();
      myCol.Add( "F", "1.49" );
      myCol.Add( "A", "1.29" );
      myCol.Add( "B", "1.49" );
      myCol.Add( "C", "1.29" );
      myCol.Add( "D", "0.89" );
      myCol.Add( "E", "0.99" );

      Console.WriteLine(myCol.Contains("A"));
   }
}

The code above generates the following result.





















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




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator