In most programming languages, dictionaries are preferred over hashtables. What are the reasons behind that?
The Hashtable
is a loosely-typed data structure, so you can add keys and values of any type to the Hashtable
. The Dictionary
class is a type-safe Hashtable
implementation, and the keys and values are strongly typed. When creating a Dictionary
instance, you must specify the data types for both the key and value.