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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Neha SharmaPosted Oct 20, 2012, 3:21 AM
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.
Satyapriya NayakPosted Oct 20, 2012, 3:16 AM
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
Santhosh Kumar JayaramanPosted Oct 20, 2012, 2:33 AM
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