C# Error CS1936 – Could not find an implementation of the query pattern for source type ‘{0}’. ‘{1}’ not found.

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.

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

C# Compiler Error CS0442 – ‘Property’: abstract properties cannot have private accessors Reason for the Error You’ll get this error...
This is a really simple one . Below is a simple example of an enum called “Designation” defined with the...
This blog post explain the usage of the Checked Block in .NET and how you can use them in Visual...