views:

2473

answers:

4

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

(edit: duplicate from here)

A: 

Well, based on what you say, I think you should use collection when you just need to store the data and you don't care at all in what order.

Marc
That applies equally to either - just don't call Sort; there are much bigger differences - see the details in the "duplicate from here" thread)
Marc Gravell
A: 

in this question you can see the difference between list and collection of T

Ruben
+3  A: 

Scott Hanselman asked this question once. You can read his related blog post here.

Recep
A: 

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 the List and inherit from the Collection.

OJ