Arraylist vs List of type Object. | Sololearn: Learn to code for FREE!

+8

Arraylist vs List of type Object.

Arraylist is just like a normal list which can store any value by upcasting the elements to "object" class. Can the same be done by declaring a generic list of type Object? If so what's the advantage of one over the other?

4/5/2018 4:13:25 PM

Rusty.Metal

1 Answer

New Answer

+8

ArrayList belongs to the days that C# didn't have generics. It's deprecated in favor of List<T>. You shouldn't use ArrayList in new code that targets .NET >= 2.0 unless you have to interface with an old API that uses it.