I'm always confusing about this stuff.
I have this query :
string[] names = { "Tom", "Dick", "Harry", "Mary", "Jay" };
IEnumerable<string> query = names.Where(n => n.Contains("a"))
.OrderBy(n => n.Length)
.Select(n => n.ToUpper());
I've read in a book that:
The compiler processes a query expression by translating it into fluent syntax
But in Reflector I see the opposite:
This is not fluent syntax.
So what does the compiler sees?
A "compiler" is by definition a device which translates a text written in one language into another language.
The C# compiler logically translates C# programs that contain query expressions into C#-without-query-expressions, and then translates those programs into IL. (Note that it need not actually do that middle stage of translation; it must behave as though it does so, but if the compiler writers are clever enough to skip that intermediate step and still get the right output then we certainly can do so.)
Reflector is also a compiler. It translates IL into C#. How it does so is it's business.
You can't make any conclusions about what the C# compiler does based on the output of Reflector; they are completely different programs written by different people to solve different problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With