-1

I know advantages and disadvantages of Hashtable and Dictionary.

I want to know when Hash-table is preferred over Dictionary ?

Aftab Ahmed
  • 1,727
  • 11
  • 15

1 Answers1

2

HashTable is not a Generic Collection, so you can save anytype (object) types into Hashtable and its type is not known at compile time.

Dictionary is a Generic collection so you need to specify the type before saving elements into it, so it is type safe.

I want to know when Hash-table is preferred over Dictionary ?

i don't think this is true because Dictionary is Typesafe and also faster because of no burden of boxing and unboxing of the elements as its elements type is known at compile time.

so you should consider using Dictionary over Hash-Table

Sudhakar Tillapudi
  • 25,935
  • 5
  • 37
  • 67