0

I recently tried nCalc for parsing formula from strings. But when I tried static parameters I always ended with null as a result. Here is the example I tried:

Expression e = new Expression("[bProd] + [bUp]");

e.Parameters["bProd"] = 50;
e.Parameters["bUp"] = 60;

var res = e.Evaluate();

Where res is always null. The nCalc Doc about static didn't helped me. Can anyone point me to the problem? I am using the latest version of nCalc included using nuget.

Yurii
  • 4,811
  • 7
  • 32
  • 41
JJR
  • 773
  • 2
  • 13
  • 32
  • 1
    I copy-pasted your code to the empty console project and I've got 110 as a result. Can you do the same thing? – astef Dec 25 '13 at 15:24
  • @astef Yes. I simplified it for this question and the only problem was type casting, meaning the numbers (50,60) where interpreted as strings (I used `var`) Now that I changed them to integer all worked fine! Even if that makes no sense for me it was the only change I applied. Thanks! – JJR Dec 25 '13 at 16:58

0 Answers0