views:

280

answers:

1

What is the purpose of this UnaryExpression, and how should it be used?

+3  A: 

It takes an Expression object and wraps it with another Expression. For instance, if you have an expression which is for a lambda, using it in the tree will create a lambda expression, but using it quoted will result in an expression for a lambda in the output.

method                                 | resulting object                   | after compile
--------------------------------------------------------------------------------------------------
Expression.Lambda(...                  | Expression of lambda               | Lambda
Expression.Quote(Expression.Lambda(... | Expression of expression of lambda | Expression of lambda
Omer van Kloeten