c# - How does Collections and List store objects of different types ? Is it Possible? -
how generic collections , list store objects of different types ? possible?
because collections , list replacement arraylist
the main advantage of generic collections can specify exact type want store in collection , don't need boxing.
you have options here:
- you stick nongeneric collections in
system.collectionsnamespace take object parameter. - you create generic collection of type object. more or less same above, can use extension methods exist
ienumerable<t>. - you create generic collection of common interface, types want store, implement.
Comments
Post a Comment