https://msdn.microsoft.com/en-us/library/bb397951.aspx

Expression trees represent code in a tree-like data structure, where each node is an expression, for example, a method call or a binary operation such as x < y.

You can compile and run code represented by expression trees.

This enables dynamic modification of executable code, the execution of LINQ queries in various databases, and the creation of dynamic queries.

For more information about expression trees in LINQ, see How to: Use Expression Trees to Build Dynamic Queries (C# and Visual Basic).

Expression trees are also used in the dynamic language runtime (DLR) to provide interoperability between dynamic languages and the .NET Framework and to enable compiler writers to emit expression trees instead of Microsoft intermediate language (MSIL).

For more information about the DLR, see Dynamic Language Runtime Overview.

You can have the C# or Visual Basic compiler create an expression tree for you based on an anonymous匿名的 lambda expression,

or you can create expression trees manually by using the System.Linq.Expressions namespace.

Creating Expression Trees from Lambda Expressions

When a lambda expression is assigned to a variable of type Expression<TDelegate>, the compiler emits发出,放射;发行;发表 code to build an expression tree that represents the lambda expression.

The C# and Visual Basic compilers can generate expression trees only from expression lambdas (or single-line lambdas).

It cannot parse statement lambdas (or multi-line lambdas).

For more information about lambda expressions in C#, see Lambda Expressions (C# Programming Guide);

for Visual Basic, see Lambda Expressions (Visual Basic).

The following code examples demonstrate how to have the C# and Visual Basic compilers create an expression tree that represents the lambda expression num => num < 5 (C#) or Function(num) num < 5 (Visual Basic).

Expression<Func<int, bool>> lambda = num => num < ;

最新文章

  1. Asp.net Boilerplate源码中NotNullAttribute的用处
  2. Xcode 运行程序,左侧memory 不显示内存
  3. C# 实现函数回调
  4. 为mongodb数据库添加安全账户
  5. bootstrap全局CSS样式学习
  6. 暑假热身 E. 无聊的LSY
  7. 内存分配(c/c++)
  8. &lt;Liunx常用命令一&gt;之TOP
  9. 编写爬虫(spider)的预备知识:用java发送HTTP请求
  10. Alice&amp;#39;s Chance
  11. slurm-16.05.3任务调度系统部署与测试(1)
  12. Linux 命令行
  13. 整合shiro出现【Correct the classpath of your application so that it contains a single, compatible version of org.quartz.Scheduler】
  14. assert BOOST_ASSERT的坑
  15. TensorFlow 计算模型 -- 计算图
  16. 第15月第29天 ffmpeg AVERROR_EOF
  17. JavaScript--详解typeof的用法
  18. Android:活动的简单使用
  19. (转载)【cocos2dx 3.x Lua] 注册事件函数详解
  20. [OI向?] ubuntu下一些常用的技巧

热门文章

  1. android shape stroke只绘制一边或者某几边
  2. html5——多媒体(一)
  3. JAVA和JVM运行原理揭秘
  4. [ECharts]&quot;echarts/config&quot; is not exists
  5. js中关于new Object时传参的一些细节分析
  6. .htaccess使用
  7. 【Flutter学习】基本组件之AppBar顶部导航栏
  8. 最新 Xilinx vivado IP许可申请
  9. codevs2833 奇怪的梦境
  10. webstorm汉化后乱码现象解决