C#3.0 新特性系列(8) Linq
1 class Program
2 {
3 static void Main()
4 {
5 int [] ar = {1,2,3,4,5};
6
7 //IEnumerable<T>
8 var res = from e in ar
9 where e > 3
10 select e;
11
12 foreach(var i in res)
13 {
14 Console.WriteLine(i);
15 }
16
17 }
18 }
2 {
3 static void Main()
4 {
5 int [] ar = {1,2,3,4,5};
6
7 //IEnumerable<T>
8 var res = from e in ar
9 where e > 3
10 select e;
11
12 foreach(var i in res)
13 {
14 Console.WriteLine(i);
15 }
16
17 }
18 }