15
The dynamic language runtime (DLR) has some pretty cool code for Expression's, including some very nice code to print out Expression trees which I want to use so that:
int a = 1;
int b = 2;
Expression<Func<int, int>> expression = (c) => a + (b * c)
expression.Evaluate(5, stringBuilder)
Outputs:
(5) => a + (b * c) = 11 Where
a = 1
b * c = 10 Where
b = 2
c = 5
I found some code on the net to do this but found that it only works if the expressiontakes in no arguments.
I then discovered the DLR implementation of a similar method. However the DLR has its own custom implementations of the Expression class and many other standard C# types so I got a little confused. Anyone know how I can implement the above?