2
Answers

Acessing hashtables

onez

onez

20y
1.6k
1
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)