Hi, all,
If I write follow code in c# method. The IDE will compile it to a complex construct method of System.Linq.Exp ression.
Expression<Func <int>ex = () =10;
will be compile to:
Expression<Func <int>ex = Expression.Lamb da<Func<int>(Ex pression.Litera l(10))
It is so smart. I can travel in this expression tree. I can do some smart abilities on this design.
Now, I want write a console application. If user input follow string from console,
() =10
I want make a LambdaExpressio n object and execute it in my context.
I can use CodeDom to compile some c# code to a dynamic assembly. But I have not found a utility to compile c# code to an expression object.
How to compile a c# Lambda expression to a Expression object? Help me. Thanks.
If I write follow code in c# method. The IDE will compile it to a complex construct method of System.Linq.Exp ression.
Expression<Func <int>ex = () =10;
will be compile to:
Expression<Func <int>ex = Expression.Lamb da<Func<int>(Ex pression.Litera l(10))
It is so smart. I can travel in this expression tree. I can do some smart abilities on this design.
Now, I want write a console application. If user input follow string from console,
() =10
I want make a LambdaExpressio n object and execute it in my context.
I can use CodeDom to compile some c# code to a dynamic assembly. But I have not found a utility to compile c# code to an expression object.
How to compile a c# Lambda expression to a Expression object? Help me. Thanks.
Comment