 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Hashtable vs. Dictionary in C#
Hashtable
A hash table is used when you need to access elements by using key, and you can identify a useful key value. Each item in the hash table has a key/value pair. The key is used to access the items in the collection.
The members in a Hashtable are thread safe. It returns null if we try to find a key that does not exist. Hashtable is not a generic type.
The Hashtable collection is slower than dictionary because it requires boxing and unboxing.
To declare a Hashtable −
Hashtable ht = new Hashtable();
Dictionary
Dictionary is a collection of keys and values in C#. Dictionary is included in the System.Collection.Generics namespace. Dictionary is a generic type and returns an error if you try to find a key which is not there.
The Dictionary collection is faster than Hashtable because there is no boxing and unboxing.
To declare a Dictionary −
IDictionary<int, string> d = new Dictionary<int, string>();
