zoukankan      html  css  js  c++  java
  • Linq

    1 基本语法
      IEnumerable<int> scoreQuery =
                from score in scores
                where score > 80
                select score;


    2 分组
    var queryGroupByAverages = from student in students
                                   group new { student.FirstName, student.LastName }
                                        by student.ExamScores.Average() > 75 into studentGroup
                                   select studentGroup;

    3 分组子查询

        var queryGroupMax =
            from student in students
            group student by student.Year into studentGroup
            select new
            {
                Level = studentGroup.Key,
                HighestScore =
                (from student2 in studentGroup
                 select student2.ExamScores.Average()).Max()
            };

    4 动态筛选选(在运行时动态指定谓词筛选器)

            var queryNames =
                from student in students
                let i = student.ID.ToString()
                where ids.Contains(i)
                select new { student.LastName, student.ID };

    http://msdn.microsoft.com/zh-cn/library/bb397676.aspx

  • 相关阅读:
    成员对象和封闭类
    静态成员
    this指针
    类型构造构造函数
    拷贝构造函数
    C++
    矩阵快速幂求递推式
    对浅拷贝和深拷贝的基本理解
    传引用作为形参和返回值_节省参数拷贝的时间
    namespace的基本知识
  • 原文地址:https://www.cnblogs.com/taoys/p/2110701.html
Copyright © 2011-2022 走看看