The death of the ArrayList
In the good old .NET 1.x days where Generics wasn’t born yet, the ArrayList was the class to use for just about any type of collection. It was much easier to use compared to an array of objects and it did the job very well. It was kind of the do-it-all solution for the lazy developer that just needed things to work the first time.
Along came the .NET Framework 2.0 which introduced Generics to the platform. Since the first beta of Visual Studio “Whidbey” was released more than two years ago, I’ve written a couple hundred thousand lines of code in C# 2.0 and not once used an ArrayList. Generic collections like Collection<> and List<> replaced the ArrayList completely from my code and that makes me wonder: Are there still a place for the ArrayList or is it dead?
If it is dead, why hasn’t Microsoft deprecated it with the [obsolete] attribute or at least made a note about it in the documentation? Because Microsoft doesn’t consider it being dead I wonder if I have missed something. Maybe there is a place for it in some obscure scenarios I just haven’t found yet, but I sincerely doubt there is.
So, is the ArrayList dead or not?
Comments
Comments are closed