select用法

 String[] arr = new[] { "1", "123" };
            IEnumerable<int> arrSelectIndex = arr.Select<String, int>((s, i) => Convert.ToInt32(s) + i);
            foreach (int i in arrSelectIndex)
            {
                Console.WriteLine(i);
            }
            IEnumerable<int> arrSelect = arr.Select<String, int>(s => Convert.ToInt32(s)).ToList();
            foreach (var s in arrSelect)
            {
                Console.WriteLine(s);
            }

posted @ 2011-01-19 14:48  Devin Mao  阅读(225)  评论(0编辑  收藏  举报