[SOLVED] Dictionary<,> == HashTable? | Sololearn: Learn to code for FREE!


[SOLVED] Dictionary<,> == HashTable?

or its different but similar?

6/13/2021 10:03:18 PM


2 Answers

New Answer


I didn't even realize HashTable was still being included after all these years since generics were supported in .NET 2, back in 2006. I just now saw that it's carried forward into .NET 5 and 6-Preview as well. HashTable was pretty much replaced by Dictionary<TKey, TValue> once generics were released. At the very least, it's not recommended for new development. I assume it's still around only for really old legacy code. https://docs.microsoft.com/en-us/dotnet/api/system.collections.hashtable?view=net-5.0#remarks https://github.com/dotnet/platform-compat/blob/master/docs/DE0006.md That said, if you still want a list of differences, this link might help: https://www.c-sharpcorner.com/blogs/difference-between-dictionary-and-hashtable-in-c-sharp


It is not implemented as a hash table but uses the same concept.