fork(1) download
  1. using System;
  2. using System.Linq;
  3. using System.Linq.Expressions;
  4.  
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10.  
  11. BinaryExpression b1 = Expression.MakeBinary(ExpressionType.Multiply, Expression.Constant(10), Expression.Constant(5));//(10*5)
  12. BinaryExpression b2 = Expression.MakeBinary(ExpressionType.Divide, Expression.Constant(9), Expression.Constant(4));//(9/4)
  13. BinaryExpression b4 = Expression.MakeBinary(ExpressionType.Add, b1, b2);
  14. var compiledLambda = (Func<int>)Expression.Lambda<Func<int>>(b4).Compile();
  15. Console.WriteLine(compiledLambda());
  16.  
  17.  
  18. }
  19. }
Success #stdin #stdout 0.04s 31688KB
stdin
Standard input is empty
stdout
52