var expresion = new Expression("if([param1] > 5, [param2], 0.00)");
expresion.Parameters.Add("param1", 5);
expresion.Parameters.Add("param2", 1.5m);
var lambda = expresion.ToLambda<decimal>();
var result = lambda();
I am getting an ArgumentException with the following message: "Argument types do not match".
If I change the value of param2 to be a double, it works. My understanding is that 0.00 in this context is interpreted as a double and the 2 arguments of the if function must be of the same type.
I am getting an
ArgumentException
with the following message: "Argument types do not match". If I change the value ofparam2
to be a double, it works. My understanding is that 0.00 in this context is interpreted as a double and the 2 arguments of the if function must be of the same type.