a blog for those who code

Thursday, 26 June 2014

System.Collections.Generic.IEnumerable does not contain any definition for 'ToList'

You might be getting this error 'System.Collections.Generic.IEnumerable' does not contain any definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?).

The solution is in this error itself i.e. "are you missing a using directive". Yes you are missing System.Linq. You have to add using System.Linq to get access to the ToList() function on the current code file.

No comments:

Post a Comment

Contact Us

Name

Email *

Message *

Sponsers

Best Hosting Plans

CC License