using System;
using System.Collections;
public class SamplesHashtable {
public static void Main() {
Hashtable myHT = new Hashtable();
myHT.Add( "one", "A" );
myHT.Add( "two", "B" );
myHT.Add( "three", "C" );
myHT.Add( "four", "D" );
myHT.Add( "five", "E" );
Console.WriteLine( " Count : {0}", myHT.Count );
Console.WriteLine( " Values:" );
PrintKeysAndValues( myHT );
myHT.Clear();
Console.WriteLine( "After Clear," );
Console.WriteLine( " Count : {0}", myHT.Count );
Console.WriteLine( " Values:" );
PrintKeysAndValues( myHT );
}
public static void PrintKeysAndValues( Hashtable myHT ) {
foreach ( DictionaryEntry de in myHT )
Console.WriteLine( "\t{0}:\t{1}", de.Key, de.Value );
}
}