Possible Duplicate:
Can these two LINQ queries be used interchangeably?
var query = from c_1 in collection_1
select c_1.collection_2 into c_2
select c_2.collection_3 into c_3
select c_3;
相当于
var query = collection_1
.Select(c_1 => c_1.collection_2)
.Select(c_2 => c_2.collection_3)
.Select(c_3 => c_3);
a) 但是哪个查询表达式等效于以下 LINQ 查询:
var query = collection_1
.Select(c_1 => c_1.collection_2
.Select(c_2 => c_2.collection_3.Select(c_3 => new { c_1, c_2, c_3 } )));
谢谢
最佳答案
var query = from c_1 in collection_1
select from c_2 in c_1.collection_2
select from c_3 in c_2.collection_3
select new { c_1, c_2 c_3 };
关于linq - 哪个查询表达式相当于以下 LINQ 查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13018026/