zoukankan      html  css  js  c++  java
  • c# dt.AsEnumerable ().Join用法

    dt1.AsEnumerable().Join(dt2.AsEnumerable(), r1 => r1.Field<object>("id"), r2 => r2.Field<object>("id"), (r1, r2) => r1);
    
                   //查找非小题非组合题,分数为空的序号
                    List<int> nilScoreRow = detailTable.AsEnumerable().Where(x => LibSysUtils.ToDecimal(x["pre_score"]) == 0).
                        Where(x => LibSysUtils.ToBoolean(x["is_minor"]) == false).
                        Where(x => x.RowState != DataRowState.Deleted).
                        Where(x => LibSysUtils.ToInt(x["quiz_type"]) != (int)EnumERSType.CombinationType).
                        Select(x => LibSysUtils.ToInt(x["sort_no"])).ToList();
                    //组合题
                    EnumerableRowCollection<DataRow> combinationList = detailTable.AsEnumerable().
                        Where(x => LibSysUtils.ToInt(x["quiz_type"]) == (int)EnumERSType.CombinationType).
                        Where(x => x.RowState != DataRowState.Deleted);
                    //查找有小题分数的组合题
                    List<int> nilCombinationList = detailTable.AsEnumerable().Where(x => LibSysUtils.ToBoolean(x["is_minor"]) == true).
                        Where(x => LibSysUtils.ToDecimal(x["pre_score"]) == 0).
                        Where(x => x.RowState != DataRowState.Deleted).
                        Join(combinationList, x => x.Field<object>("parent_id"), y => y.Field<object>("quiz_id"), (x, y) => y)
                        .Select(y=> LibSysUtils.ToInt(y["sort_no"])).Distinct().ToList();
                    nilScoreRow.AddRange(nilCombinationList);
    

      

  • 相关阅读:
    2019 SDN大作业
    个人作业——软件工程实践总结作业
    1.机器学习,从入门到放弃入门
    python25之进制转换
    python学习24之异常
    python学习23之标准库
    python学习22之函数式编程
    python学习21之高级特性
    python学习20之面向对象编程高级
    python学习19类5之多态与鸭子模型
  • 原文地址:https://www.cnblogs.com/deepalley/p/14102633.html
Copyright © 2011-2022 走看看