Mega Code Archive

 
Categories / C# by API / System Collections
 

HashTable Keys

using System;  using System.Collections;    class HashtableDemo {    public static void Main() {      Hashtable ht = new Hashtable();                 ht.Add("a", "A");      ht.Add("b", "B");      ht.Add("c", "C");      ht.Add("e", "E");        // Get a collection of the keys.      ICollection c = ht.Keys;        foreach(string str in c)        Console.WriteLine(str + ": " + ht[str]);    }  }