Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is LINQ Expression tree?

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces what LINQ Expression tree is, the article is very detailed, has a certain reference value, interested friends must read it!

LINQ Expression tree

A LINQ Expession tree cannot be changed after it is created. If a program takes an Expression tree as an argument and then simply uses it to generate other forms of code (such as SQL statements), this immutability will have no effect. But what if a program wants to modify an Expression tree? The solution is to copy a new tree from the source Expression tree and choose whether to copy the original node directly or create a modified node according to your own needs in the replication process. There is an example on MSDN that explains how to implement this requirement and how to: modify the expression directory tree.

A more detailed discussion of LINQ Expression tree will be left for later. Look at the code first:

Digraph ExpressionTree {node [fontsize=12, fontcolor=blue, font=Courier Shape=box] / / node declarations lambda [label= "Lambda Expression"] anoFuncSig [label= "Anonymous Function\ nSignature"] arrow [label= "= >"] anoFuncBody [label= "Anonymous Function\ nBody"] impFuncSig [label= "Implicit Anonymous\ nFunction Signature"] expr [label= "Expression"] impParam [label= "Implicit Anonymous\ nFunction Parameter"] uexpr1 [label= Unary Expression "] neg [label="-"] uexpr2 [label=" Unary Expression "] id [label=" Identifier:\ Identifier "] nx [nx" Simple Name:\ nx "] / / relations lambda-> anoFuncSig lambda-> arrow lambda-> anoFuncBody {rank=same AnoFuncSig arrow anoFuncBody} anoFuncSig-> impFuncSig anoFuncBody-> expr {rank=same; impFuncSig expr} impFuncSig-> impParam expr-> uexpr1 [style=dashed] {rank=same; impParam uexpr1} impParam-> id uexpr1-> neg uexpr1-> uexpr2 {rank=same; id neg uexpr2} uexpr2-> simpName}

Ast.dot:

Digraph ExpressionTree {node [fontsize=12, fontcolor=blue, font=Courier, shape=box] edge [fontsize=10, fontcolor=purple] / / node declarations lambda [label= "Lambda Expression"] param [label= "Parameter:\ nx"] body [label= "Unary Expression\ n (Negation)"] param2 [label= "Simple Name:\ nx"] / / relations lambda-> param [label= "Signature"] lambda-> body [label= "Body] {rank=same Param body} body-> param2 param-> param2 [label= "(same node)", fontsize=8, style=dashed, dir=both]} above is all the content of this article "what is LINQ Expression tree?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report