IEnumerable, and its generic counterpart IEnumerable<T> are .NET interfaces for iterating (or enumerating) through a collection of items.


Non-generic interface in .NET for collections of objects which can be accessed individually by index

Functions specific

Quality Example
Less specific

"An ienumerable is less specific than an ilist"

from question "Why return Interfaces eg IEnumerable, IList - example of refactoring"

"Ienumerable is less specific than an ilist that is ilist has functions that ienumerable does not"

from question "Should I return an IEnumerable or IList?"


"Ienumerable is less specific than ilist"

from question "When to use IList and when to use List"


Quality Example

"Ilist is stronger in that it makes more guarantees than ienumerable"

from question "Accept the weakest, return the strongest. But why?"


"Ienumerable is more abstract and is generally preferred to list or ilist if possible"

from question "List<> Versus IEnumerable<>, when defining a new class or a new viewmodel class"

"Thus ilist is more than ienumerable and you won t be able to get away with it"

from question "Conversion of IEnumerable<T> to IList"

Interface more functionality

"You need to use tolist to convert it from ienumerable because the ilist interface supports more functionality than the ienumerable interface"

from question "How to cast to a List<IEnumerable<XElement>>"

Lighter rather

"Yes i understand that ienumerable is much more lighter rather than ilist but anyway there is a lot situations where we need to have ilist instead of ienumerable and in this approach we need to cast ienumerable to ilist isn t it"

from question "EF 4.0 Repository pattern IList<T> or IEnumerable<T>"

More specialized

"The reason why this doesn t work specifically is because ilist is more specialized than ienumerable"

from question "Error due to concrete class and interface not having matching return types for IEnumerable<T> and List<T>"


"Ienumerable is less specific than ilist ilist implements ienumerable so unless you want something specific from ilist such as .count as you suggest or perhaps add delete etc i d use ienumerable"

from question "What should I use an IEnumerable or IList?"

More abstract

"Another suggestion change you to because you can keep an extension method for more collections because the ienumerable is more abstract than ilist"

from question "How to using class with static method in C#?"

Back to Home
Data comes from Stack Exchange with CC-BY-SA-3.0