Difference between Hashtable and Dictionary in C#:
The following table lists the difference between Hashtable and Dictionary in C#.
|Hashtable included in System.Collections namespace.||Dictionary included in System.Collections.Generic namespace.|
|Hashtable is loosely typed (non-generic) collection, this means it stores key-value pairs of any data types.||Dictionary is generic collection. So it can store key-value pairs of specific data types.|
|Hashtable is thread safe.||Only public static members are thread safe in Dictionary.|
|Hashtable returns/throws Exception if we try to find a key which does not exist.||Dictionary returns null if we try to find a key which does not exist.|
|Data retrival is slower than dictionary because of boxing-unboxing.||Data retrival is faster than Hashtable.|