zoukankan      html  css  js  c++  java
  • linq 集合按照多列进行distinct

                    List<TaskBatch> sourceList = (from c in BatchCollecion
                                                  group c by new
                                                      {
                                                          c.CustomId,
                                                          c.OutsourcingDate,
                                                          c.ServiceId
                                                      } into grp
                                                  select grp.First()).ToList();

    或者

                List<TaskBatch> sourceList = BatchCollecion.GroupBy(x => new { x.CustomId, x.ServiceId, x.OutsourcingDate }).Select(x => x.First()).ToList();

  • 相关阅读:
    python
    python
    python
    Django学习手册
    python
    Django学习手册
    [ThinkPHP] 独立分组配置,坑!!!
    vim 代码片段:通过vundle插件管理器安装ultisnips |centos6.5|vim7.2
    CESHI
    thinkphp实现功能:验证码
  • 原文地址:https://www.cnblogs.com/swarb/p/9924268.html
Copyright © 2011-2022 走看看