Question

I have just begun working on a asp.net 4.5 (C#) webpage. I have just beginning to learn LINQ. To make sure I am doing everything right I pasted this code (from a Microsoft tutorial into a code file) :

int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 };
        var numQuery =
            from num in numbers
            where (num % 2) == 0
            select num;

However everything is not right because it says System.LINQ does not exist and intelisense gives me this error when I hover over the keyword from : Feature 'query expression' cannot be used because it is not part of the ISO-2 language specification. I feel like I am missing a reference.

Was it helpful?

Solution

Have a read through this

To enable basic LINQ functionality

  • In a Visual Basic or C# project, click the Project menu, and then click Add Reference.
  • In the Add Reference dialog box, click the .NET tab, scroll to System.Core.dll, and then click it. Click OK.
  • Add a using directive or Imports statement for System.Linq to your source code file or project.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top