这是编译器从以下查询表达式生成的代码吗? [英] Is this the code the compiler generates from the following query expression?

查看:28
本文介绍了这是编译器从以下查询表达式生成的代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

     var result = from c1 in a1
                  from c2 in a1.a2
                  from c3 in a1.a2.a3
                  select new { c1.id, c2.id, c3.id };

这是编译器根据上面的查询表达式生成的代码:

Is this the code the compiler generates from the above query expression:

var result = a1.SelectMany(
      c1 => a1.a2.SelectMany(
         c2 => a1.a2.a3.Select(
            c3 => new {c1,c2,c3})));

谢谢

推荐答案

您是正确的.

这是一个完整的外部联接,将包含 a1.Count * a2.Count * a3.Count 个项目,包括源序列中每个项目的组合/

This is a full outer join and will contain a1.Count * a2.Count * a3.Count items, including every combination of items from the source sequences/

这篇关于这是编译器从以下查询表达式生成的代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆