What is the difference between Collection and List?

  • Thread starter Thread starter Leon_Amirreza
  • Start date Start date
L

Leon_Amirreza

What is the difference between Collection and List?
When shoud I use Collections and when to use Lists?
 
Leon_Amirreza said:
What is the difference between Collection and List?
When shoud I use Collections and when to use Lists?

Use Collection<T> for overriding if you need your own custom list. Use
List<T> otherwise.

Additionally, in public interfaces, don't expose concrete types, use
IList<T>, ICollection<T> or IEnumerable<T>, depending on what you want to
make available to clients.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top