The below diagram clearly defines the difference between IEnumerable, ICollection, IList and List by listing the methods available in each of them.
The following table provides various scenarios to use IEnumerable, ICollection, IList and List and it will help you to decide which type you should use.
Interface | Scenario |
IEnumerable, IEnumerable<T> | The only thing you want is to iterate over the elements in a collection. You only need read-only access to that collection. |
ICollection, ICollection<T> | You want to modify the collection or you care about its size. |
IList, IList<T> | You want to modify the collection and you care about the ordering and / or positioning of the elements in the collection. |
List, List<T> | Since in object oriented design you want to depend on abstractions instead of implementations, you should never have a member of your own implementations with the concrete type List/List. |