using System; using System.Linq.Expressions; namespace Developpez.Dotnet { public static partial class GenericOperators { private static Func MakeBinaryOperator(ExpressionType op) { var x = Expression.Parameter(typeof(T), "x"); var y = Expression.Parameter(typeof(T), "y"); var body = Expression.MakeBinary(op, x, y); var expr = Expression.Lambda>(body, x, y); return expr.Compile(); } } }