dynamicexpresso / DynamicExpresso

C# expressions interpreter
http://dynamic-expresso.azurewebsites.net/
MIT License
2.02k stars 379 forks source link

Hello, I encountered a situation and I would like to know if there is a way to achieve it. Please take a look at my code #320

Open jiangzhuangxiansheng opened 2 months ago

jiangzhuangxiansheng commented 2 months ago

Hello, I encountered a situation and I would like to know if there is a way to achieve it. Please take a look at my code:

var target = new Interpreter() .SetVariable("a", 10) .SetVariable("b", 5); var expression = "a + b";

I would like to obtain the expression "10 + 5"

davideicardi commented 1 month ago

Sorry @jiangzhuangxiansheng , but I'm not sure to understand what is your problem. I think you can write something like:

var result = target.Eval("a + b");
jiangzhuangxiansheng commented 1 month ago

var expression = target.xxx("a + b") return expression The result is "10 + 5" instead of 15

davideicardi commented 1 month ago

Can you show me the full code? I suppose the problem is that the variables that you are using are of type string , not numbers (int, ...).

metoule commented 1 week ago

I think it's a duplicate of #254