标签:count() color from 形式 lin bsp void string where
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); //发放查询 int numsCount = (from n in numbers //两种形式组合 where n < 20 select n).Count(); foreach (var x in numsQuery ) { Console.Write("{0} ", x); } Console.WriteLine(); foreach (var x in numsMethod ) { Console.Write("{0} ", x ); } Console.WriteLine(); Console.WriteLine("{0}", numsCount ); } } }
标签:count() color from 形式 lin bsp void string where
原文地址:https://www.cnblogs.com/bedfly/p/11960595.html