I saw this reply from Jon on Initialize generic object with unknown type
If you want a single collection to contain multiple unrelated types of values, however, you will have to use
List<object>
I'm not comparing ArrayList
vs List<>
, but ArrayList
vs List<object>
, as both will be exposing item of type "object". What would be the benefit of using either one in this case?
EDIT: It's no concern for type safety here, since both class is exposing object as it's item. One still need to cast from object to the desired type. I'm more interested in anything other than type safety
EDIT: Thanks Marc Gravell and Sean for the answer. Sorry, I can only pick 1 as answer, so I'll up vote both.