I'm trying to learn a bit of LINQ but I'm having compile issues right off the bat. Is there any specific reason why this won't work?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HelloLINQ {
class HelloLINQ
{
public static void Main()
{
Example1();
}
public static void Example1()
{
var numbers = new int[] { 1, 5, 3, 7, 3, 8, 9, 3, 6, 6, 2 };
var under5 = from n in numbers
select n;
foreach (var n in under5)
{
Console.WriteLine(n);
}
}
}
}
The error is:
Could not find an implementation of the query pattern for source type 'int[]'. 'Select' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?