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);
    

      

  • 相关阅读:
    守护线程
    接口中的方法重写
    jvm内存结构
    浅拷贝,深拷贝
    队列
    12月4号荒度了一天
    同步条件
    条件变量
    信号量Semaphore
    sql练习
  • 原文地址:https://www.cnblogs.com/deepalley/p/14102633.html
Copyright © 2011-2022 走看看