Hi..
Ques : Hello friend now I an working collection in a .NET. In a collection i am using Hashtable but i am not understaind How does a Hashtable internally maintain the key-value pairs?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Feb 20, 2012, 11:16 PM
Jignesh TrivediPosted Feb 20, 2012, 10:55 PM
A HashTable collection stores a (Key, Value) pair and uses the Key to hash and obtain the storage location. The Key is immutable and cannot have duplicate entries in the HashTable. This sample uses several instances of a simple Person class to store in a HashTable. The last name is used as the Key.
hope this help.
VulpesPosted Feb 20, 2012, 11:48 AM
http://msdn.microsoft.com/en-us/library/system.collections.hashtable.aspx
Contrary to what it says there, the key/value pairs are not actually stored in DictionaryEntry objects but these objects are created when the Hashtable needs to be iterated.