mparlak / Flee

Fast Lightweight Expression Evaluator
607 stars 119 forks source link

How to update express with CalculationEngine #112

Open dboydboy opened 3 months ago

dboydboy commented 3 months ago

I used CalculationEngine to manage and calculate a group of express,like as:

var engine = new CalculationEngine(); var context = new ExpressionContext(); engine.Add("x", "2", context); engine.Add("y", "sqrt(x)", context); engine.Add("z", "y * 3", context);

And i want to update the "x", and it could update the referenced express auto... I tried the following:

engine.Remove("x"); engine.Add("x", "9", context); engine.GetResult("y")

there is a exception like as: System.ArgumentException:“No expression is associated with the name 'y'” So, How could i update the "x"?