ADVERTISEMENT
ADVERTISEMENT

Why is Dictionary preferred over Hashtable in C#?

Here, we are going to learn why is Dictionary preferred over Hashtable in C#.Net?
Submitted by Nidhi, on January 13, 2021

The Dictionary and Hashtable, both are collections in the .NET framework. The Dictionary is the generic collection, whereas Hashtable is a non-generic collection. It is very interesting that in the .Net framework Dictionary is implemented using Hashtable.

The Dictionary is preferred over HashTable because of type-safety and it maintains the order of stored values. We cannot insert the random object into the dictionary. Both Dictionary and Hashtable are used key/value pairs to store the data elements.

ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.