请解释此Linq查询 [英] Explain this Linq query please

查看:92
本文介绍了请解释此Linq查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
任何人都可以解释一下此msdn链接中给出的以下LINQ查询.
查询是:

Hi there,
Can any one please explain the following LINQ query given in this msdn link.
The query is:

public void Linq19()
{
    List<Customer> customers = GetCustomerList();
    var customerOrders =
        customers.SelectMany(
            (cust, custIndex) =>
            cust.Orders.Select(o => "Customer #" + (custIndex + 1) +
                                    " has an order with OrderID " + o.OrderID));
    ObjectDumper.Write(customerOrders);
}





http://msdn.microsoft.com/en-us/vcsharp/aa336758#SelectSimple1 [ ^ ]





http://msdn.microsoft.com/en-us/vcsharp/aa336758#SelectSimple1[^]

推荐答案

以下是SelectMany如何工作的说明.
http://www.codethinked.com/a-visual-look-at- the-linq-selectmany-operator [ ^ ]
希望对您有所帮助.
Here is the explanation how SelectMany works.
http://www.codethinked.com/a-visual-look-at-the-linq-selectmany-operator[^]
I hope this would help.


这篇关于请解释此Linq查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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