Linq - Convert query expressions to dot notation

I am learning Linq. Most Linq examples are available in query expression format. To better understand this, I would like to know what the query expression looks like in dotted notation or lambda syntax. Although I can translate simple point expressions into point format, I am in a desire when expressions become complex.

Are there any general rules for this conversion manually?

Also is there a tool that can do such a conversion for me from a query expression to a dot format and vice versa? The C # compiler preprocesses the query expression in dot format before compiling. If there is no such tool, is there a way to view the pre-processed code before compiling it?

+3
source share
2 answers

Yes, grab a copy of LINQPad . This is a great tool for learning LINQ. The tool is free and allows you to make very simple and very complex LINQ prototyping. You can also alternate C # code. It will show you your queries in Lambda form, and also show you the received T-SQL code if you request a database.

Highly recommended.

+6
source

For tools, I'd prefer Randy's suggestion. However, I would say that it is also worth reading the C # language specification, which shows how it all works, explaining transparent identifiers and the like. You should be able to use the specification to predict what the tool will show you.

0
source

Source: https://habr.com/ru/post/1776514/


All Articles