Erik Forbes
Erik Forbes

Reputation: 35861

Are there any reasons to use Hashtables when there is a generic Dictionary class?

Are there any reasons to use Hashtables when there is a generic Dictionary class? If so, what are they?

Upvotes: 1

Views: 125

Answers (3)

activebiz
activebiz

Reputation: 6230

Dictionary is fast becouse it knows about what to store. But If you want to store objects then HashTable is faster becouse element of HashTable are object types.

Upvotes: 0

C. Dragon 76
C. Dragon 76

Reputation: 10062

Probably not anymore unless maybe you're working with, or need to interoperate with, .NET 1.x code.

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1500525

Not unless you're using .NET 1.1 or the micro-framework, no. Ditto the other pre-generics collections, with the slight exception of some of the classes in System.Collections.Specialized namespace, which don't all have direct generic replacements.

Upvotes: 2

Related Questions