C
Ching-Lung
Hi,
How do I get the index of a specific key/value in a hash
table?
Hashtable ht = new Hashtable();
ht.Add("k1", "v1"); // ht[0]
ht.Add("k2", "v2"); // ht[1]
ht.Add("k3", "v3"); // ht[2]
ht.Add("k4", "v4"); // ht[3]
ht.Add("k5", "v5"); // ht[4]
if(ht.ContainsKey("k2")){
// how do I get the index of "k2"?
}
Please help. Thanks.
-CL
How do I get the index of a specific key/value in a hash
table?
Hashtable ht = new Hashtable();
ht.Add("k1", "v1"); // ht[0]
ht.Add("k2", "v2"); // ht[1]
ht.Add("k3", "v3"); // ht[2]
ht.Add("k4", "v4"); // ht[3]
ht.Add("k5", "v5"); // ht[4]
if(ht.ContainsKey("k2")){
// how do I get the index of "k2"?
}
Please help. Thanks.
-CL