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)
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)
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.
Scott Hanselman asked this question once. You can read his related blog post here.
Provides the base class for a generic collection.
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.