Different between arraylist and dictionary in c#
briefly describe about both and also differentiate between them.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Oct 19, 2012, 10:33 PM EDT
ArrayList- automatically growing array. Adds more overhead. Can enum., probably slower than a normal array but still pretty fast. These are used a lot in .NETDictionary- Key value pair same as hash table only strongly typed via generics, such asDictionary
Instead of array list you should use List<>. Thats generics
Satyapriya NayakRank #47 · 31.5K reputationPosted Oct 19, 2012, 11:16 PM EDT
Please refer the below links
http://www.dotnetperls.com/arraylist
http://www.c-sharpcorner.com/UploadFile/puranindia/C-Sharp-arraylist/
http://www.dotnetperls.com/dictionary
http://www.c-sharpcorner.com/UploadFile/mahesh/dictionary-in-C-Sharp/
Thanks
Neha SharmaRank #569 · 4.3K reputationPosted Oct 19, 2012, 11:21 PM EDT
1. Dictionary :
stores the KeyValue pairs. It is a generic collection class, which means there is Type safety. Generic types are particularly efficient in case of value types as they avoid boxing and unboxing. The corresponding non generic collection class is HashTable.
2. ArrayList :
is a non generic collection class to store items. The corresponding generic collection class is List which is preferable for the same reason mentioned above.
If it helps you mark it answer.