June 30, 2011

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 :-))

3 comments:

Anonymous said...

thanks! Helpful for me!

Anonymous said...

Thanks! Helpful for me!

Anonymous said...

nice , with description information