Howdy, Stranger!

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


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

Damian99Damian99 USAMember Posts: 116

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



  • mk44mk44 UKMember Posts: 9

    Dictionary is type safe, Hashtable isn't.

  • DavidMDavidM USAMember Posts: 342

    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.