- Arithmetic Operations
- Assign Expression
- Comparison Expression
- Conditional Expression
- Exception Expression
- Iteration Expression
- Jump Expression
- Logical Expression
- Member Expression
- Operators Expression
Expression Tree Tutorial Property Expression
You can build an expression tree which contains accessing a given property by its name using Expression.Property
method. For example, you have the following code.
TestClass obj = new TestClass(); obj.myProperty = 60; Console.WriteLine(obj.myProperty);
Here is the code that is required to build the same functionality using expression tree.
Expression propertyExpr = Expression.Property( Expression.Constant(obj), "myProperty" ); Console.WriteLine(Expression.Lambda<Func<int>>(propertyExpr).Compile()());