I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
using System;
using System.Linq;
class LinqExercise
{
static void Main()
{
int[] numbers = {
1, 3, 6, 9, 10, -4, -2, -3, -88, 12, 19, 14
};
var nQuery =
from VrNum in numbers
where VrNum > 0
where VrNum < 10
select VrNum;
Console.Write("\nThe numbers within the range of 1 to 10 are : \n");
foreach (var VrNum in nQuery)
{
Console.Write("{0} ", VrNum);
}
Console.ReadLine();
}
}
I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
Result:
The numbers within the range of 1 to 10 are :
1 3 6 9
need an explanation for this answer? contact us directly to get an explanation for this answer