Quantcast
Channel: NCalc - Mathematical Expressions Evaluator for .NET
Viewing all articles
Browse latest Browse all 58

Created Unassigned: Adding a Parameter in the EvaluateParameter delegate [28354]

$
0
0
Hi, can we have the ability to add new parameters to the the expression when the EvaluateParameter delegate is running. For example:
```
expression.EvaluateParameter += delegate(string name, ParameterArgs args)
{
// get hold of the parameter
string myParam = "[Sub] * [Expression]";

args.Result = new Expression(myParam);
}
```
I've also tried
```
expression.EvaluateParameter += delegate(string name, ParameterArgs args)
{
// get hold of the parameter
string myParam = "[Sub] * [Expression]";

expression.Parameters.Add(name, new Expression(myParam));
}
```
Neither of those work. Can this be made possible?

At the moment I'm using a LogicalExpressionVisitor to find all parameters needed in the calculation and all the calculation parameters (recursively), and I then look these up and add them as parameters. The parameters are currently public properties on a plain object.

Viewing all articles
Browse latest Browse all 58

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>