使用查询语法 而不只用循环

查询语法的使用

1             int[] foo = new int[100];

2             for (int num = 0; num < foo.Length; num++)
3             {
4                 foo[num] = num + num;
5             }
6          
7 
8              foo = (from n in Enumerable.Range(0100)
9                          select n * n).ToArray();
posted @ 2014-01-06 16:50  yellowshorts  阅读(127)  评论(0编辑  收藏  举报