查询表达式到点表示法



hei,需要一些帮助才能将此 linq 查询转换为点表示法:

            var productions =
            from row in data
            group row by row.PRODUCTION_NAME into gr
            select new
            {
                Group = gr.Key,
                Jobs = from row in gr
                       orderby row.SortFieldCard
                       group row by row.JOB_NAME into job
                       select new { job.Key, Cards = job }
            };
var productions = data
    .GroupBy(row => row.PRODUCTION_NAME)
    .Select(gr => new
    {
        Group = gr.Key,
        Jobs = gr
            .OrderBy(row => row.SortFieldCard)
            .GroupBy(row => row.JOB_NAME)
            .Select(job => new { job.Key, Cards = job })
    });

嗯。如果你的意思是Linq的流畅表示法(你说的是"dot net",两者都是dot net(.NET)),我认为这应该可以解决问题:

var productions = data
  .GroupBy(row => row.PRODUCTION_NAME)
  .Select(gr => new {
    Group = gr.Key,
    Jobs = gr
      .OrderBy(row => row.SortFieldCard)
      .GroupBy(row => row.JOB_NAME)
      .Select(job => new { job.Key, Cards = job})
  });

相关内容

  • 没有找到相关文章

最新更新