0
Hello Friend,
Following link may help you solve your problem.
http://www.dotnetperls.com/ienumerable
With Regards,
Vishal Gilbile
0
IEnumerable or its generic equivalent IEnumerable<T>, is just an interface which all enumerable collections (arrays, lists etc) should implement.
Although you can't create instances of these interfaces, you can have variables of these interface types which can accept references to any object which implements them.
These interfaces are particularly important because they enable you to use the 'foreach' statement to iterate through an enumerable collection and to use the LINQ extension methods on them as well.
So, in your example, 'sorted' contains a reference to an object which implements IEnumerable<int>. In other words, it's a sequence of integers.
This can therefore be passed to your Display method which takes a parameter of that type and the sequence can then be iterated through using foreach.