Cybercrux

Everything is achievable through technology

IEnumerable

Zeichnung-IEnumerable-ICollection-IList

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s