【C#表达式树 四】Expression类上的函数列表
Expression相当于工厂,这个工厂有各式各样的模型(函数),用来生成各种零部件(节点类型),最后组装成表达式树。
Expressions这个命名空间有各种个容器用陈放生产出来的零部件。
Expression 非常接近于类型Emit ,Emit就是直接 使用IL指令进行编程,它的最主要用途就是编译一个动态方法 ,恰好Expression 的主要作用
也是如此 ,可以把Expression编程看作是对Emit的一个简单的基于oo的封装,它们直接针对的更低层语言(IL)的接口,比如 Expression里面
没有while,for foreach,等种种循环,就是一个Expression.Loop(...) 就完了,类似还有Block 这个也有传入传出,和方法相似
列表中每个名字其实对应着一组函数(130个),这些函数函数有些有多重载(330个),但返回值的类型是一样的。
这些工厂方法所生成的表达式的意义应该说还是很直观的,就不特别介绍了。经常跟编译器打交道的话应该对这些名字尤其熟悉。
下一节我们开始使用这些函数创建表达式树节点
函数功能 | 返回值类型 | |
Add | BinaryExpression | |
AddAssign | BinaryExpression | |
AddAssignChecked | BinaryExpression | |
AddChecked | BinaryExpression | |
And | BinaryExpression | |
AndAlso | BinaryExpression | |
AndAssign | BinaryExpression | |
ArrayIndex | BinaryExpression | |
Assign | BinaryExpression | |
Coalesce | BinaryExpression | |
Divide | BinaryExpression | |
DivideAssign | BinaryExpression | |
Equal | BinaryExpression | |
ExclusiveOr | BinaryExpression | |
ExclusiveOrAssign | BinaryExpression | |
GreaterThan | BinaryExpression | |
GreaterThanOrEqual | BinaryExpression | |
LeftShift | BinaryExpression | |
LeftShiftAssign | BinaryExpression | |
LessThan | BinaryExpression | |
LessThanOrEqual | BinaryExpression | |
MakeBinary | BinaryExpression | |
Modulo | BinaryExpression | |
ModuloAssign | BinaryExpression | |
Multiply | BinaryExpression | |
MultiplyAssign | BinaryExpression | |
MultiplyAssignChecked | BinaryExpression | |
MultiplyChecked | BinaryExpression | |
NotEqual | BinaryExpression | |
Or | BinaryExpression | |
OrAssign | BinaryExpression | |
OrElse | BinaryExpression | |
Power | BinaryExpression | |
PowerAssign | BinaryExpression | |
ReferenceEqual | BinaryExpression | |
ReferenceNotEqual | BinaryExpression | |
RightShift | BinaryExpression | |
RightShiftAssign | BinaryExpression | |
Subtract | BinaryExpression | |
SubtractAssign | BinaryExpression | |
SubtractAssignChecked | BinaryExpression | |
SubtractChecked | BinaryExpression | |
Block | BlockExpression | |
TryGetActionType | bool | |
TryGetFuncType | bool | |
Catch | CatchBlock | |
MakeCatchBlock | CatchBlock | |
Condition | ConditionalExpression | |
IfThen | ConditionalExpression | |
IfThenElse | ConditionalExpression | |
Constant | ConstantExpression | |
ClearDebugInfo | DebugInfoExpression | |
DebugInfo | DebugInfoExpression | |
Default | DefaultExpression | |
Empty | DefaultExpression | |
Dynamic | DynamicExpression | |
MakeDynamic | DynamicExpression | |
ElementInit | ElementInit | |
Lambda<TDelegate> | Expression<TDelegate> | |
Break | GotoExpression | |
Continue | GotoExpression | |
Goto | GotoExpression | |
MakeGoto | GotoExpression | |
Return | GotoExpression | |
ArrayAccess | IndexExpression | |
MakeIndex | IndexExpression | |
Property | IndexExpression | |
Invoke | InvocationExpression | |
Label | LabelExpression | |
Label | LabelTarget | |
Lambda | LambdaExpression | |
ListInit | ListInitExpression | |
Loop | LoopExpression | |
Bind | MemberAssignment | |
Field | MemberExpression | |
MakeMemberAccess | MemberExpression | |
Property | MemberExpression | |
PropertyOrField | MemberExpression | |
MemberInit | MemberInitExpression | |
ListBind | MemberListBinding | |
MemberBind | MemberMemberBinding | |
ArrayIndex | MethodCallExpression | |
Call | MethodCallExpression | |
NewArrayBounds | NewArrayExpression | |
NewArrayInit | NewArrayExpression | |
New | NewExpression | |
Parameter | ParameterExpression | |
Variable | ParameterExpression | |
RuntimeVariables | RuntimeVariablesExpression | |
SwitchCase | SwitchCase | |
Switch | SwitchExpression | |
SymbolDocument | SymbolDocumentInfo | |
MakeTry | TryExpression | |
TryCatch | TryExpression | |
TryCatchFinally | TryExpression | |
TryFault | TryExpression | |
TryFinally | TryExpression | |
GetActionType | Type | |
GetDelegateType | Type | |
GetFuncType | Type | |
TypeEqual | TypeBinaryExpression | |
TypeIs | TypeBinaryExpression | |
ArrayLength | UnaryExpression | |
Convert | UnaryExpression | |
ConvertChecked | UnaryExpression | |
Decrement | UnaryExpression | |
Increment | UnaryExpression | |
IsFalse | UnaryExpression | |
IsTrue | UnaryExpression | |
MakeUnary | UnaryExpression | |
Negate | UnaryExpression | |
NegateChecked | UnaryExpression | |
Not | UnaryExpression | |
OnesComplement | UnaryExpression | |
PostDecrementAssign | UnaryExpression | |
PostIncrementAssign | UnaryExpression | |
PreDecrementAssign | UnaryExpression | |
PreIncrementAssign | UnaryExpression | |
Quote | UnaryExpression | |
Rethrow | UnaryExpression | |
Throw | UnaryExpression | |
TypeAs | UnaryExpression | |
UnaryPlus | UnaryExpression | |
Unbox | UnaryExpression | |
CanReduce | bool | |
Reduce | Expression | |
NodeType | ExpressionType | |
Type | Type |
编程是个人爱好