LINQ 把数组大于10的数字输出

        int[] nums = new int[] { 3, 5, 21, 53, 99, 43, 37, 29, 2 };
        IEnumerable<int> result = nums.Where(a => a > 10);
        foreach(int num in result)
        {
            Console.WriteLine(num);
        }

 

posted @ 2022-08-26 16:35  NangFah  阅读(39)  评论(0)    收藏  举报