onez

onez

  • NA
  • 73
  • 0

Acessing hashtables

Aug 9 2004 12:59 AM
The only way I can access the keys and values of a hashtable is through a foreach statement. Is there some other way to access individual keys or values like in an arraylist? Hashtable H = new Hashtable(); Hashtable F = new Hashtable(); H.Add("CA", "California"); H.Add("IL", "Illinois"); string sk= H.Key[0].ToString(); // this doesn't work but need to do something like this string sv = H.Value[0].ToString(); F.Add(sk, sv); Should I use another kind of collection?

Answers (2)