We have to imports system.collections namespace.
using System;
using System.Collections;
1st way:-
Hashtable hashtable = new Hashtable();
hashtable[1] = "rajesh";
hashtable[2] = "kumar";
hashtable[3] = "sathua";
foreach (DictionaryEntry entry in hashtable)
{
console.writeline("{0}, {1}", entry.Key, entry.Value);
}
2nd way:-
Hashtable hashtable = new Hashtable();
hashtable.Add("1","rajesh");
hashtable.Add("2","kumar");
hashtable.Add("3","sathua");