The Hashtable class represents a series of key/value pairs that are organized by key-based hash codes. He uses keys to access the elements in the collection.
Using system;using system.collections;namespace collectionsapplication{ class program { static void Main (string[] args) { Hashtable ht = new Hashtable (); Ht. ADD ("001", "Zara Ali"); Ht. ADD ("002", "Abida Rehman"); Ht. ADD ("003", "Joe Holzner"); Ht. ADD ("004", "Mausam Benazir Nur"); Ht. ADD ("005", "M. Amlan"); Ht. ADD ("006", "M. Arif"); Ht. ADD ("007", "Ritesh Saikia"); if (HT. Containsvalue ("Nuha Ali")) { Console.WriteLine ("This student name was already in the list"); } else { ht. ADD ("008", "Nuha Ali"); } Gets the collection of keys ICollection key = Ht. Keys; foreach (string k in key) { Console.WriteLine (k + ":" + ht[k]); } Console.readkey ();}}}
C # Hash Table (Hashtable)