Friday, 14 August 2015

ArrayList vs List

If you are doing some migration from old C# code to new code, you might need this :

Arraylists only acceps objects, so that means that while you can add any object you want to the list, it will have to be boxed (implicitly by the CLR) and then it has to be unboxed again (explicitly by you) when you need the values.

This is not needed in List<T>.

So, convert all Arraylist to List<T> for better performance.

No comments:

Post a Comment