using System;
using System.Linq;
using System.Linq.Expressions;
public class Test
{
public static void Main()
{
BinaryExpression b1 = Expression.MakeBinary(ExpressionType.Multiply, Expression.Constant(10), Expression.Constant(5));//(10*5)
BinaryExpression b2 = Expression.MakeBinary(ExpressionType.Divide, Expression.Constant(9), Expression.Constant(4));//(9/4)
BinaryExpression b4 = Expression.MakeBinary(ExpressionType.Add, b1, b2);
var compiledLambda = (Func<int>)Expression.Lambda<Func<int>>(b4).Compile();
Console.WriteLine(compiledLambda());
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uTGlucTsKdXNpbmcgU3lzdGVtLkxpbnEuRXhwcmVzc2lvbnM7CgoKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoKQmluYXJ5RXhwcmVzc2lvbiBiMSA9IEV4cHJlc3Npb24uTWFrZUJpbmFyeShFeHByZXNzaW9uVHlwZS5NdWx0aXBseSwgRXhwcmVzc2lvbi5Db25zdGFudCgxMCksIEV4cHJlc3Npb24uQ29uc3RhbnQoNSkpOy8vKDEwKjUpCkJpbmFyeUV4cHJlc3Npb24gYjIgPSBFeHByZXNzaW9uLk1ha2VCaW5hcnkoRXhwcmVzc2lvblR5cGUuRGl2aWRlLCBFeHByZXNzaW9uLkNvbnN0YW50KDkpLCBFeHByZXNzaW9uLkNvbnN0YW50KDQpKTsvLyg5LzQpCkJpbmFyeUV4cHJlc3Npb24gYjQgPSBFeHByZXNzaW9uLk1ha2VCaW5hcnkoRXhwcmVzc2lvblR5cGUuQWRkLCBiMSwgYjIpOwp2YXIgY29tcGlsZWRMYW1iZGEgPSAoRnVuYzxpbnQ+KUV4cHJlc3Npb24uTGFtYmRhPEZ1bmM8aW50Pj4oYjQpLkNvbXBpbGUoKTsKQ29uc29sZS5Xcml0ZUxpbmUoY29tcGlsZWRMYW1iZGEoKSk7CgoKCX0KfQ==