1) Subquery is a query within a query and as such must start with a FROM clause and end with SELECT or GROUP BY clause. But I'm puzzled why don't we also consider as a subquery those nested statements that only have a FROM clause ( thus they don't end with SELECT or GROUP BY ).
The behavior of from c_2 in collection_2
is very similar to the behaviour of a subquery, since it enumerates the entire collection_2
for every c_1
element. Since their behaviours are remarkably similar, why aren't statements such as from c_2 in collection_2
also considered as subqueries ( you could argue that a subquery returns a result, but same argument could also be said of from c_2 in collection_2
, since it does get converted into a call to SelectMany
)?
var query = from c_1 in collection_1
from c_2 in collection_2
select ...
thank you