Mega Code Archive

 
Categories / C# / Collections Data Structure
 

Enumerating a hash table collection

using System; using System.Collections; class Test{   public static void Main() {        Hashtable ht = new Hashtable(10);             // Add strings to the hashtable associated with a        // key value (integer).             ht.Add( 100, "Z");        ht.Add( 200, "A");        ht.Add( 300, "B");        ht.Add( 400, "S");        ht.Add( 500, "G");             foreach ( DictionaryEntry de in ht ) {          Console.WriteLine( "Entry Key {0} Value {1}", de.Key, de.Value );        }   } }