Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I was reading Which Kind Of Array Or Collection Should I Use?

The document states to use list for the most performance.

"...They are the fastest array in unity. For this reason, built-in arrays are the best choice if you need the fastest performance possible from your code (for example, if you're targeting iPhone)...performs significantly faster than ArrayList."

I am inclined to use list besides performance issues as well because...

But it got me to wonder, since everyone seems to favor to make a degrading statement about ArrayLists, is ArrayLists that horrible? If so why does it even exist? Is it more of trace of supposedly deprecated codes?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Yes, ArrayLists are slow (relative). ArrayLists were part of the .NET framework before .NET 2.0 was released. .NET 2.0 brought us generics which are better for 'generic' collections. More specifically, ArrayLists' .Add method accepts objects causing boxing, whereas, a List<T> takes a predetermined type.. therefore, increasing performance.

For all practical purposes, the functionality of ArrayList in the current .NET Framework is for backwards compatibility with project using .NET Framework 1.0 / 1.1.

share|improve this answer
    
Thank you for resolving my curiosity :D –  Tofu_Craving_Redish_BlueDragon Mar 9 at 23:56
1  
They are so slow and old that they are not supported anymore for newer platforms, so you won't find them if you try to compile your game to Windows Phone or Windows Store Apps. –  Roberto Mar 10 at 0:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.