The Hashtable object contains items in key/value pairs. The keys are used as indexes, and very quick searches can be made for values by searching through their keys.
Hashtable hashtable = new Hashtable();
key = 1;
name = "A";
hashtable.Add(key,name);
key = 2;
name = "B";
hashtable.Add(key,name);
key = 3;
name = "lily";
hashtable.Add(key,name);
u can use foreach loop for read
foreach (string key in hashtable.Keys) {
Response.Write(key + '=' + hashtable[key] + "<br>");
}
No comments:
Post a Comment