Pregunta de entrevista de AXIS Capital

when would you use generics and what are its advantages compared to ArrayList

Respuesta de la entrevista

Anónimo

10 sep 2012

Generics are strongly typed, iteration is typesafe, no casting or test for type necessary. More LINQ extension methods apply to generic than non-generic collections. Can extract all elements of the same type from an ArrayList with ArrayList.OfType(), and then proceed working with the generic, strongly-typed List.