using System;
using System.Linq;namespace LINQ语法实现
{class Program{static void Main(string[] args){int[] a = { 3,1,2,4};//1.Query syntaxvar Query1 = from num in a where num % 2 == 0 orderby num select num;foreach (var i in Query1){Console.WriteLine("{0}", i);}Console.WriteLine();//2.Method syntaxvar Query2 = a.Where(n => n % 2 == 0).OrderBy(n => n);foreach (var j in Query2){Console.WriteLine("{0}", j);}}}
}