码迷,mamicode.com
首页 > Windows程序 > 详细

C#高级泛型集合中的where

时间:2015-09-11 19:03:43      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:

class Program
    {
        //泛型集合中的where
        static void Main(string[] args)
        {
            List<int> nums = new List<int>() { 1,2,3,4,5};

           IEnumerable<int> num =  nums.Where(n => n > 2);

           foreach (var item in num)
           {
               Console.WriteLine(item);
           }
           Console.ReadKey();
        }
    }

 

C#高级泛型集合中的where

标签:

原文地址:http://www.cnblogs.com/phpweige/p/4801638.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!