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.collections namespace 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

Popular posts from this blog

400 Bad Request on Apache/PHP AddHandler wrapper -

Add email recipient to all new Trac tickets -

php - Change action and image src url's with jQuery -