Why is Dictionary preferred by the developers over hashtable in C#?

Can someone please explain me why is Dictionary preferred over hashtable in C#?

Comments

  • Dictionary is type safe, Hashtable isn't.

  • Dictionary is a generic type, Hashtable is not. Type safety is assured with Dictionary since it is not possible to insert any random object into it. It is not required to cast the values you take out.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories