What’s the .NET collection class that allows an element to be accessed using a unique key?

 Posted by Rajni.Shekhar on 3/19/2012 | Category: ASP.NET Interview questions | Views: 5110 | Points: 40
Answer:

HashTable class that allows an element to be accessed using a unique key.

Example:
 Hashtable ht = new Hashtable();

ht["mykey1"] = "My Value1";
ht["mykey2"] = "My Value2";
ht["mykey3"] = "My Value3";
ht["mykey4"] = "My Value4";

Response.Write(ht["mykey1"].ToString());


Source: http://dot-net-tech-questions- | Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response