Possible Duplicate:
When to use IList and when to use List
This question could just be a lack of understanding of the .NET framework, but what is the benefit of actually having a set of data in an interface rather than just having it in a list? Up to this point I have only used List<T>
and it seems to do pretty much what I need it to do, but looking at other peoples code I see that it is quite frequent for someone to use IEnumerable<T>
, IQueryable
/IQueryable<T>
, ICollection<T>
, and even IList<T>
. That being said, what is even the difference between List<T>
and IList<T>
?
I understand that some of them have different functionality on the contained objects, but which is the most safest to go with? IEnumerable
?