Dictionary<>
is a generic type and so it's type safe.
You can insert any value type in HashTable and this may sometimes throw an exception. But Dictionary<int>
will only accept integer values and similarly Dictionary<string>
will only accept strings.
So, it is better to use Dictionary<>
instead of HashTable
.