Scanned fragments seem to be invalid. c_3 not defined as part of the Select statement, so if I do not understand something, this will not compile.
It seems you are trying to select collection_3 elements, but this is done implicitly with SelectMany , so the final Select statements in both cases are redundant. Take them out and the two queries are equivalent.
All you need is:
var query = collection_1 .SelectMany(c_1 => c_1.collection_2) .SelectMany(c_2 => c_2.collection_3);
Update: x => x is an identical mapping, so Select(x => x) always redundant, regardless of context. It just means "for each item in the sequence, select the item."
The second fragment, of course, is different, and the SelectMany and Select operators really need to be nested to select all three elements: c_1 , c_2 and c_3 .
Like Gert, he says that you should probably use the syntax for understanding the query. This is much more concise and facilitates the mental analysis of the operation of the request.
source share