public Func <TFirst, TSecond, TResult> Compile(Native.Expression nativeExpression) { var parameters = _parameter1.GetNativeParameters() .Concat(_parameter2.GetNativeParameters()) .ToArray(); var actualLambda = Native.Expression.Lambda(nativeExpression, parameters); var func = actualLambda.Compile(); if (!_parameter1.IsCompound && !_parameter2.IsCompound) { return((Func <TFirst, TSecond, TResult>)func); } Native.Expression <Func <TFirst, TSecond, TResult> > wrapper = (conditionParameter, parameter) => (TResult)func.DynamicInvoke( _parameter1.ExtractValues(conditionParameter) .Concat(_parameter2.ExtractValues(parameter)) .ToArray()); return(wrapper.Compile()); }
public Func <TParameter, TResult> Compile(Native.Expression nativeExpression) { var parameters = _parameter.GetNativeParameters(); var actualLambda = Native.Expression.Lambda(nativeExpression, parameters); var func = actualLambda.Compile(); if (!_parameter.IsCompound) { return((Func <TParameter, TResult>)func); } Native.Expression <Func <TParameter, TResult> > wrapper = q => (TResult)func.DynamicInvoke(_parameter.ExtractValues(q)); return(wrapper.Compile()); }