现在的位置: 首页 > 综合 > 正文

Lambda 查询(C# 4.0)

2013年04月18日 ⁄ 综合 ⁄ 共 383字 ⁄ 字号 评论关闭
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            
    }
}

抱歉!评论已关闭.