Saturday, July 5, 2014

Cannot apply indexing with [] to an expression of type System.Collections.Generic.IEnumerable


Cannot apply indexing with [] to an expression of type System.Collections.Generic.IEnumerable
Error:
Cannot apply indexing with [] to an expression of type 'System.Collections.Generic.IEnumerable<ANY_TYPE>

Solution:
If used of IEnumerable SampleArray then you can access to elements like:
- SampleArray[index] WRONG
- SampleArray.ElementAt(index) RIGHT
Because the IEnumerable interface dose not support of [] for indexing :-))


taken from here http://blog.amastaneh.com/2011/06/cannot-apply-indexing-with-to.html for my own personal notification