Is there any method in which you can convey a mathematical statement and this will give you the result?

Is there any method in C # in which you pass the math operator, and this method will give you the result, for example, you pass this line

1+2-3/4*5

and he will give you an answer

0

+4
source share
1 answer

Use NCalc

Expression e = new Expression("2 + 3 * 5");   
Debug.Assert(17 == e.Evaluate());
+3
source

All Articles