You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For security reasons it is not possible to call any static methods like "Convert.ToInt32"; only evaluation context that is available is defined explicitly (via variables). If you need to provide some 'API' that should be available in expressions you may use this approach:
class MathFunctions {
public double Pow(double x, double y) => Math.Pow(x,y);
}
varContext["Math"] = new MathFunctions();
Console.WriteLine(lambdaParser.Eval("Math.Pow(2,2)", varContext));
(this can be Convert variable that holds an object that has ToInt32 method, for instance).
var res = lambdaParser.Eval("Convert.ToInt32("111")", varContext)
this is not work well. how to support more system namespace class and functions?
The text was updated successfully, but these errors were encountered: