Mega Code Archive

 
Categories / C# / Collections Data Structure
 

Searches for a key

using System; using System.Collections; using System.Collections.Specialized; public class SamplesListDictionary  {    public static void Main()  {       ListDictionary myCol = new ListDictionary();       myCol.Add( "A", "1.49" );       myCol.Add( "B", "1.29" );       myCol.Add( "C", "0.99" );       // Searches for a key.       if ( myCol.Contains( "A" ) )          Console.WriteLine( "The collection contains the key \"A\"." );       else          Console.WriteLine( "The collection does not contain the key \"A\"." );       Console.WriteLine();   }     }