Clear a HashTable

Akiii
Posted by Akiii under C# category on | Points: 40 | Views : 1750
HashTable provide a Clear() method to clear all the items.

Hashtable EmpHashTable = new EmpHashTable();
EmpHashTable.Add("Key1", "Akiii");
EmpHashTable.Add("Key2", "Sharad");
EmpHashTable.Add("Key3", "Anirban");



protected void btnClear_Click(object sender, EventArgs e)
{
EmpHashTable.Clear();
ListBoxCloths.DataSource = EmpHashTable;
ListBoxCloths.DataBind();
lblMessage.Text = "HashTable Items Cleared";
}




Thanks and Regards
Akiii
Read more: http://mrbool.com/how-to-work-with-hashtable-using-csharp-and-asp-net/24995#ixzz21JdypGxT

Comments or Responses

Login to post response