Lambda 查询(C# 4.0)

class SimpleLambda
{
    static void Main()
    {

        // Data source.
        int[] scores = { 907182937582 };

        // The call to Count forces iteration of the source
        int highScoreCount = scores.Where(n => n > 80).Count();

        Console.WriteLine("{0} scores are greater than 80", highScoreCount);

        // Outputs: 4 scores are greater than 80            
    }
}
posted on 2011-11-28 16:07  一路前行  阅读(497)  评论(0编辑  收藏  举报