Difference between Hashtable and Dictionary
Hashtable | Dictionary |
Hashtable is present in System.Collections namespace. | Dictionary is present in System.Collections.Generic namespace |
Hashtable is the non-generic collection, it can store data in key, the value of any type of data | Dictionary is the generic collection, it can store data in key, value pair of a specific datatype |
Hashtable is thread-safe | The only member is thread-safe |
return null if the key is not present in hashtable | throw an exception if the key is not present |
slower than Dictionary | faster than Hashtable |