c# - LINQ expression trees -


I read in a book on LINQ that expression trees are likely to make expression trees manually). It has been written that there may be some precise query tuning in it, normal query operators can not perform. I can not imagine such a situation, can someone give me some examples? Thank you.

Generally, this happens when the organization or compilation type is not known in time compilation, or While the query can not be worked hard (for example, to allow for the group / sort / filter criteria provided by the user) it may be cumbersome, so you can use this process as the emergence of libraries such as dynamic LINQ Step by step and your query dynamically The criteria can be prepared in the form of text. Then those libraries have parsed your criteria and created the form of expression tree itself, in the same way how you can make it manually using the expression API.

Beyond them, I can only think of an additional case when required to create a tree manually: when you have expression & lt; TDelegate & gt; , and you have it fixed within the nested expression other expression tree, if everything is typed steady, then you can not directly do it in C # with lambda expressions because you have nested expression (You can implement TDelegate , but not an expression ) Thus, you have to build the tree manually. See for example.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Algorithm negotiation fail SSH in Jenkins -

java - Messages from .properties file do not display UTF-8 characters -