About
What's going on here?
This site uses Microsoft's "Roslyn" CTP
to implement section 7.16.2 of the
C# language specification,
namely the translation of C# query expressions into the equivalent chain of method invocations.
This is purely a syntactic mapping; it can be performed on a query expression in absolute isolation.
For example, from person in People select person.Age
can be translated into
People.Select(person => person.Age)
without any knowledge of what Person
represents or what Age
might represent for a person
found within it.
Even Select
doesn't have to be the
usual extension method.
The specification defines six explicit steps to apply to perform the transformation, which I aim to implement
faithfully. I have added the further step of removing unnecessary parentheses from expressions; although
this is not explicitly included in the specification, the examples given do remove parentheses
where they are not necessary. A final step, which the C# compiler does not have to worry about, will be to
format the output code nicely.