I am working on a Blazor WebAssembly project using .NET 8, and I am utilizing the DynamicExpresso library to evaluate my expressions.
If we use interpreter.SetDefaultNumberType(DefaultNumberType.Decimal) , then we can’t access any default library like string related or Math related functions etc.
interpreter = new Interpreter().SetDefaultNumberType(DefaultNumberType.Decimal);
After this if we try to evaluate below string for a loaded variable strVariable , Below expression will not evaluate.
strVariable.Substring(0, 40)
if we create the interpreter with this interpreter = new Interpreter() then above expression will evaluate.
I have tried to add reference for the string and Math lib as below , but it still does not work , it only works if we remove the SetDefaultNumberType option.
interpreter = interpreter.Reference(typeof(System.String));
interpreter = interpreter.Reference(typeof(System.Math));
can someone help on this issue. as we need to set Default Number Type and also have some access to libraries for extension methods etc.
Mahar Taimur is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.