C# Error CS1934 – Could not find an implementation of the query pattern for source type ‘{0}’. ‘{1}’ not found. Consider explicitly specifying the type of the range variable ‘{2}’.

C# Error

CS1934 – Could not find an implementation of the query pattern for source type ‘{0}’. ‘{1}’ not found. Consider explicitly specifying the type of the range variable ‘{2}’.

Reason for the Error & Solution

Could not find an implementation of the query pattern for source type ‘type’. ‘method’ not found. Consider explicitly specifying the type of the range variable ‘name’.

This error is produced if a query expression specifies a data source for which no standard query operators are implemented. One way to produce this error is to specify an ArrayList without giving an explicit type for the range variable.

To correct this error

  1. In the following example, the solution is to just specify the type of the range variable:

    var q = from int x in list  
    

Example

The following example shows one way to produce CS1934:

// cs1934.cs  
using System.Linq;  
using System.Collections;  
static class Test  
{  
    public static void Main()  
    {  
        var list = new ArrayList { 0, 1, 2, 3, 4, 5 };  
        var q = from x in list // CS1934  
                select x + 1;  
    }  
}  

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...