I'm looking to see if there is a method or tool to view how things like closures or query expressions are created by the c# compiler "under the hood". I've noticed that many blog posts dealing with these issues will have the original code with syntactic sugar and the underlying c# code that the compiler converts that to. So for example with linq and query expressions they would show:
var query = from x in myList select x.ToString();
then the resulting code would be
var query = myList.Select(x=>x.ToString());
Is it possible with a tool or do you just have to know how it works from the spec and go from there?
Resharper can do this conversion (LINQ expression syntax to lambda syntax) for you very easily.
LINQPad has a tab that can show you the lambda expression syntax for a query you enter into it, and it has another tab that disassembles it all the way down to the IL code level. (There's another tab that shows you the SQL that gets generated if you're using LINQ to SQL or LINQ to Entities).
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