+ 1
How can I calculate string in single line?
Example: string input = "2+5*2" string output = 12
2 ответов
+ 11
https://www.codeproject.com/Articles/274093/Math-Parser-NET
There is explanation how to use.
0
I would avoid doing math on a string. Instead, convert your inputs to integers and then perform calculations. Conversion is a simple process already built into the C# libraries:
https://msdn.microsoft.com/en-us/library/system.int32.parse(v=vs.110).aspx