GroupRow.GroupBy(dr=>dr["item"]); 你还要赋值给其他的IEnumerable <DataRow>参考

解决方案 »

  1.   

     你还要赋值给其他的IEnumerable <DataRow> 
    没明白该怎么赋值给其他的IEnumerable 表就上面的两列,我要分组求和。
    能否帮写个完整的语句出来?
      

  2.   

    我这里没环境,不方便测,
    根据我1楼的链接,你应该像 IEnumerable<IGrouping<int, int>> outerSequence = presidentsOptions.GroupBy(p => p.Id, p => p.Option,compare)一样,把选择的结果赋值到IEnumerable <DataRow> 里面,他本身的顺序可能没有变,你可以试试
      

  3.   

    public static IEnumerable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>( 
        this IEnumerable<TSource> source, 
        Func<TSource, TKey> keySelector)var result = db.Student.GroupBy(Student=> Student.StudentID);