Friday, June 25, 2021

Hash Table in C#

 The Hashtable is a non-generic collection and used to store the key/value pairs based on the hash code of the key. Key will be used to access the element in the collection.

Hashtable Characteristics

  • Comes under System.Collection namespace
  • Keys must be unique and cannot be null.
  • Values can be null or duplicate.
  • Values can be accessed by passing associated key in the indexer e.g. myHashtable[key]
  • Elements are stored as DictionaryEntry objects.
  • “ContainsKey” can be used to check the key in the hash table.
URL: https://dotnetfiddle.net/Tb8E69

No comments:

Post a Comment

Hash Table in C#

 The Hashtable is a non-generic collection and used to store the key/value pairs based on the hash code of the key. Key will be used to acce...