ProAnswers.org

Preferred dictionary over a hashtable in C#?

In most of programming languages, we preferred using a dictionary over a hashtable . What are the reasons behind it?

FWIW, a Dictionary is a hash table.

If you meant "why do we use the Dictionary class instead of the Hashtable class?", then it's an easy answer: Dictionary is a generic type, Hashtable is not. That means you get type safety with Dictionary, because you can't insert any random object into it, and you don't have to cast the values you take out.