using EC.Helper.RabbitFunc.Expressions; using EC.Helper.RabbitFunc.Runtime; namespace EC.Helper.RabbitFunc.Extern; [ExternLambda] internal class MaxLambdaExpression : SystemLambdaExpression { public MaxLambdaExpression() : base(typeof(Math).GetMethod(nameof(Math.Max), new Type[] { typeof(double), typeof(double) }), "max", new BodyExpression(), Expression.Parameter(typeof(double), "left"), Expression.Parameter(typeof(double), "right")) { } private class BodyExpression : Expression { public override object Eval(RuntimeContext context) { var left = ParameterExpression.Access(context, "left"); var right = ParameterExpression.Access(context, "right"); return Math.Max(left, right); } } }