Question

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

Was it helpful?

Solution

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 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top