C# Error
CS1936 – Could not find an implementation of the query pattern for source type ‘{0}’. ‘{1}’ not found.
Reason for the Error & Solution
Could not find an implementation of the query pattern for source type ‘type’. ‘method’ not found.
In order to query a source type, that type must implement the standard query operator methods that you are invoking in the query. The implementation can be either in the form of class members or extension methods that are brought into scope with the appropriate using
directive.
To correct this error
-
Make sure that you are querying a collection of objects, not an individual object.
-
Make sure that you have specified the necessary
using
directives.
Example
The following example produces CS1936:
// cs1936.cs
using System.Collections;
using System.Linq;
class Test
{
static int Main()
{
object obj;
IEnumerable e = from x in obj // CS1936
select x;
return 0;
}
}
This error typically occurs when you accidentally try to query an object of some type instead of a collection of those objects.