Tuesday, May 10, 2011

Difference between List and Collection

List<T> inherits from Collection<T>. So they have a lot of the same functionality. List just extends it by adding members and methods to make things easier, like ForEach, TrimExcess, and ConvertAll. Collection<T> is used as the base class for all generic collections in the 2.0 Framework. You would almost always use List. The only time you would use Collection is to make your own class and use Collection as the base.

No comments:

Post a Comment