- Arithmetic Operations
- Assign Expression
- Comparison Expression
- Conditional Expression
- Exception Expression
- Iteration Expression
- Jump Expression
- Logical Expression
- Member Expression
- Operators Expression
Expression Tree Tutorial TypeAs Expression
You can build an expression tree which contains an explicit reference or boxing conversion using Expression.TypeAs
method. For example, you have the following code.
Employee e = new Employee(); object objEmp = e as object;
Here is the code that is required to build the same functionality using expression tree.
UnaryExpression typeAsExpression = Expression.TypeAs( Expression.Constant(e, typeof(Employee)),typeof(object)); Console.WriteLine(typeAsExpression.ToString());