Looping throgh HashTable

Sandhyab
Posted by Sandhyab under C# category on | Points: 40 | Views : 1069
 protected void Page_Load(object sender, EventArgs e)
{
Hashtable sh = new Hashtable();
sh.Add("Month1", "January");
sh.Add("Month2", "Feb");
sh.Add("Month3", "March");
sh.Add("Month4", "April");
sh.Add("Month5", "May");
Response.Write("Looping through Hash Table");
GetHash(sh);
}
void GetHash(Hashtable ht)
{
IDictionaryEnumerator ide = ht.GetEnumerator();
while (ide.MoveNext())
{
Response.Write(ide.Key + "-" + ide.Value + "<br/>"+"Value can be"+ht[ide.Key].ToString()+"<br/>");
}
}

Comments or Responses

Login to post response