Wondering if there is any way to get the lambda expressions that result from a LINQ "query" syntax expression.
Given:
var query = from c in dc.Colors
where c.ID == 213
orderby c.Name, c.Description
select new {c.ID, c.Name, c.Description };
Is there any way to get the generated "lambda" code / expression?
var query = dc.Colors
.Where(c => c.ID == 213)
.OrderBy(c => c.Name)
.ThenBy(c => c.Description)
.Select(c => new {c.ID, c.Name, c.Description, });
I know these are very simple examples and that the C# compiler generates a lambda expression from the query expression when compiling the code. Is there any way to get a copy of that expression?
I am hoping to use this as a training tool for some of my team members that aren't very comfortable with lambda expressions. Also, I have used Linq Pad, but ideally this can be accomplised without a 3rd party tool.