Help with your answer

Briefly explain the difference between ArrayList and Dictionary in C#?

=> asked by Jae Lee

Categories: C# interview  


<< back to questions


ArrayList is to create an array by storing object references. This means it can store anything and it would have "boxing" overhead when storing to ArrayList.

  1. ArrayList may not always offer the best performance for a given task
  2. ArrayList is not guaranteed to be sorted. You must sort the ArrayList prior to performing operations if you need a sorted list.

ArrayList belongs to the days that C# did not have generics. It is not used that much these days in favor of List. **List is a generic class and it supports storing values of a specific type without casting to or from object (which would have incurred boxing/unboxing overhead when List is a value type in the ArrayList case).


Dictionary represents a sophisticated data structure that allows you to access an element based on a key. Dictionary is also known as hash tables or maps. The main feature of dictionary is fast lookup based on keys. You can also add and remove items freely, a bit like a List, but without the performance overhead of having to shift subsequent items in memory.

over 3 years ago, by Jae Lee

Sponsored Links