阅读背景:

一个例子帮你搞懂C#语言高级特性系列(05) --- 语言集成查询(LINQ)

来源:互联网 

先看例子再做一个简单解释吧。

using System;
using System.Linq;

namespace Com.LoonStudio {
	class Program {
		static void Main(string[] args) {
			int[] x = { 13, 36, 5, 29, 10, 12, 40, 56 };
			var y = from temp in x where temp % 2 == 0 orderby temp select temp;

			foreach (int z in y) {
				Console.Write(z + "\t");
			}
			Console.WriteLine();
		}
	}
}
using System;
using System.



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: