zoukankan      html  css  js  c++  java
  • Linq/EF/lambda Group by/Order by 多个字段详细用法

    1)单个字段Group by:

    //a.Key类型与a.Province字段类型一样 

      .GroupBy(a => a.Province).Select(a => a.Key).ToList(); 

    2)多个字段Group by:

    //此时返回的数据列表需要自己转换 

      .GroupBy(a => new { a.Date, a.Week }).Select(a => a.Key).ToList();

    3)单个字段Order by:

    .OrderBy(a => a.Date).ToList()

    4)多个字段Order by:

    .OrderBy(a => a.Date).ThenBy(a => a.EndTime).ThenBy(a => a.StartTime).ToList()

    5)多个字段Order by倒序:

    .OrderByDescending(a => a.Date).ThenByDescending(a => a.EndTime).ThenByDescending(a => a.StartTime).ToList()
    版权所有:jory—经得起折磨,耐得住寂寞
  • 相关阅读:
    numpy 矩阵和数组
    python map()
    python matplotlib plot
    python mean()
    预测数值型数据:回归
    散点图
    非均衡分类问题
    AdaBoost元算法
    2.1 n元排列
    1.3 数域
  • 原文地址:https://www.cnblogs.com/jory/p/6136427.html
Copyright © 2011-2022 走看看