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
-
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;
}
}