0

i recently approached to NCalc library to execute some expressions retrieved from a db. So, i created a method that process expression's formula and after, bind the values for the parameters. At a first look, i believed that when i build an expression using the sintax

Expression ex = new Expression([formula-from-db], Evaluateoptions);

The library creates the expression, the expression tree and populates the Parameters Dictionary with parameter's names, so i can read them to evaluate. But after playing with expressions i figured out that parameters dictionary need to be manually-populated. This makes parameters verification a bit annoying. It's correct or there's a method to get parameters from formula at Expression creation time? Thank you in advance.

ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86
  • I've removed the ASP.NET Core tag here as it doesn't seem relevant to your question. Please only add relevant tags to your question. – ProgrammingLlama Nov 18 '21 at 08:27
  • I parse the formula with regex to get all the parameters. But I saw this answer that might answer your question: https://stackoverflow.com/questions/23013542/get-the-parameters-in-an-expression-using-ncalc – cmau Nov 23 '21 at 20:10

0 Answers0