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

less than 1 minute read

You might be getting this error when trying to convert the Enumerable to List using ToList. It means the namespace to import the LINQ has been missed in your class.

Error:

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

Solution:

Add the namespace - System.Linq

using System.Linq;

Tags:

Categories:

Updated:

Leave a comment