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
var valComparer = new ValueComparer() { NullComparison = ValueComparer.NullComparisonMode.Sql };
var lambdaParser = new NReco.Linq.LambdaParser(valComparer);
var varContext = new Dictionary<string, object>();
varContext["pi"] = 3.14M;
var res= lambdaParser.Eval("pi>what", varContext);
I don't have a variable name called what,So I hope I can catch an exception and give me some hints for checking,Instead of directly returning a false to me,How to catch an exception? or tell me variable name error?
The text was updated successfully, but these errors were encountered:
If you need to implement some kind of 'validation' (without actual evaluation of the expression), it is possible to get a list of expression's parameters in this way:
string exprStr = "pi>what";
var lambdaParser = new LambdaParser();
var expr = lambdaParser.Parse(exprStr);
var exprParams = lambdaParser.GetExpressionParameters(expr);
To validate parameters during evaluation you may use LambdaParser.Eval(string expr, Func<string,object> getVarValue) overload and implement your own behaviour inside getVarValue handler.
The text was updated successfully, but these errors were encountered: