Compiler Error CS1935
Could not find an implementation of the query pattern for source type 'type'. 'method' not found. Are you missing a using directive for 'System.Linq'?
The source type in a query must be IEnumerable
, IEnumerable<T>
, or a derived type, or a type for which you or someone else has implemented the standard query operators. If the source type is an IEnumerable
or IEnumerable<T>
, you must add a using
directive for the System.Linq
namespace in order to bring the standard query operator extension methods into scope. Custom implementations of the standard query operators must be brought into scope in the same way, with a using
directive and, if necessary, a reference to the assembly.
Add the required using
directives and references to the project.
The following code generates CS1935 because the using
directive for System.Linq is commented out:
// cs1935.cs
// CS1935
using System;
using System.Collections.Generic;
// using System.Linq;
class Test
{
static int Main()
{
int[] nums = { 0,1,2,3,4,5 };
IEnumerable<int> e = from n in nums
where n > 3
select n;
return 0;
}
}
.NET feedback
.NET is an open source project. Select a link to provide feedback: