34

Possible Duplicate:
What is the difference between List (of T) and Collection(of T)?

What is the best practice for when to use one vs the other?

Both implement IList<T> and hold the data in an ordered fashion, but only List expose the sorting semantics....

Community
  • 1
  • 1
AndreasKnudsen
  • 3,373
  • 4
  • 27
  • 30

1 Answers1

24
  • Collection<T>:

    Provides the base class for a generic collection.

  • List<T>:

    Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.

So, according the docs, one is intended as a base class for collections. The other is intended for use as a container.

So use List<T> and inherit from Collection<T>.

Shimmy Weitzhandler
  • 97,705
  • 120
  • 409
  • 613
OJ.
  • 28,259
  • 5
  • 53
  • 70