namespace ConsoleApplication45 { class Program { static void Main(string[] args) { int[] numbers = { 2, 5, 28, 31, 17, 16, 42 }; var numsQuery = from n in numbers //查询语法 where n < 20 select n; var numsMethod = numbers.Where(x => x < 20); //Issuing a query int numsCount = ( from n- in Numbers // two forms composition WHERE n-< 20 is SELECT n-) .Count (); the foreach ( var X in numsQuery) { Console.Write ( " {0} " , X); } Console.WriteLine (); the foreach ( var X in numsMethod) { Console.Write ( " {0} " , X); } Console.WriteLine(); Console.WriteLine("{0}", numsCount ); } } }