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