using System;
using System.Collections;
class MainClass {
public static void Main() {
// Create a hash table.
Hashtable ht = new Hashtable();
// Add elements to the table
ht.Add("A", "3");
ht.Add("B", "9");
ht.Add("C", "3");
ht.Add("D", "7");
// Demonstrate enumerator
IDictionaryEnumerator etr = ht.GetEnumerator();
Console.WriteLine("Display info using Entry.");
while(etr.MoveNext())
Console.WriteLine(etr.Entry.Key + ": " +
etr.Entry.Value);
Console.WriteLine();
Console.WriteLine("Display info using Key and Value directly.");
etr.Reset();
while(etr.MoveNext())
Console.WriteLine(etr.Key + ": " +
etr.Value);
}
}