Use Hashtable in C#

Using system.collection namespace and create object for hashtable .

 Hashtable objHashtable = new Hashtable();
protected void Page_Load(object sender, EventArgs e)
{
Create();
BindHashTable();
}
void Create()
{
objHashtable.Add("name", "Dhaval");
objHashtable.Add("surname", "Patel");
objHashtable.Add("company", "Com");

}
void BindHashTable()
{
IDictionaryEnumerator objIDicEnu = objHashtable.GetEnumerator();
while (objIDicEnu.MoveNext())
{
Response.Write(objIDicEnu.Value + " ");
}
}



Ebook Download
View all
Learn
View all