Display the contents of the collection using the enumerator
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" ); Console.WriteLine( "Displays the elements using the IDictionaryEnumerator:" ); PrintKeysAndValues2( myCol ); } public static void PrintKeysAndValues2( IDictionary myCol ) { IDictionaryEnumerator myEnumerator = myCol.GetEnumerator(); Console.WriteLine( " KEY VALUE" ); while ( myEnumerator.MoveNext() ) Console.WriteLine( " {0,-25} {1}", myEnumerator.Key, myEnumerator.Value ); Console.WriteLine(); } }