How do I translate the following query to functional calls? I know the compiler does this behind the scenes but don’t know how I would view the result
var query = from item in Enumerable.Range(0, 10)
from item2 in Enumerable.Range(item, 10)
from item3 in Enumerable.Range(item2, 10)
select new { item, item2, item3 };
In this case, it uses
SelectMany, and a concept called transparent identifiers which preserve the existing range variables. So your query would translate to:(In this case
zis the transparent identifier. If there’d been awhereclause or anything other than aselectafter the lastfromclause, another transparent identifier would have been introduced.)The translations are all described in the C# language specification, section 7.16.