Arraylist vs List of type Object. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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?

5th Apr 2018, 4:13 PM
Rusty.Metal
1 Réponse
+ 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.
5th Apr 2018, 4:21 PM
Sokrat_Poghosyan
Sokrat_Poghosyan - avatar