.NET interview questions: - Define hashtable collections?
- By Shiv Prasad Koirala in ASP.NET
- Sep 12th, 2011
- 4844
- 0
.NET interview questions: - Define hashtable collections?
In arraylist or array if we have to access any data we need to use the internal index id generated by the array list collection. For instance the below code snippet shows how the internal id is used to fetch data from array list.
In actual scenarios we hardly remember internal id's generated by collection we would like to fetch the data by using some application defined key. There's where hash table comes in to picture.
string str = MyList[1].ToString();
Hash table helps to locate data using keys as shown below. When we add data to hash table it also has a provision where we can add key with the data. This key will help us to fetch data later rather than using internal index id's generated by collections.
objHashtable.Add("p001","MyData");
This key is converted in to numeric hash value which is mapped with the key for quick lookup.
View the following video on CAS, evidence, permission set & code groups: -
Get more learning materials for Most asked .NET interview questions
Regards,
Visit author's blog for more interview questions and answers for Dotnet
Shiv Prasad Koirala
Visit us @ www.questpond.com or call us at 022-66752917... read more