关于LINQ一个简单例子


using
System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var A = new[] { 3, 4, 6, 7 }; var B = new[] { 2, 2, 3, 5, 1 }; var somInts = from a in A from b in B where a > 4 && b <= 2 select new { a, b, sum = a + b }; foreach (var a in somInts) { Console.WriteLine(a); } Console.Read(); } } }

 

posted @ 2015-10-09 23:03  持之  阅读(159)  评论(0编辑  收藏  举报