Thursday, March 22, 2018

Dictionary in C#

  • Dictionary is generic collection and includes System.Collections.Generic namespace.
  • This is collection of Key and value pair and key must be a unique.
  • In the dictionary, you cannot be including duplicate key. 
  • In the dictionary, duplicate key given run time error.

NOTE:

  1. It returns error if we try to find a key which does not exist.
  2.  It is faster than a hash table because there is no boxing and unboxing.
  3. Dictionary is a generic type which means we can use it with any data type.

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...