Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if function with decimal and double #72

Open
vinhent opened this issue Nov 16, 2022 · 0 comments
Open

if function with decimal and double #72

vinhent opened this issue Nov 16, 2022 · 0 comments

Comments

@vinhent
Copy link

vinhent commented Nov 16, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants