how to convert an expression from string to double or int in c#?

前端 未结 0 929
迷失自我
迷失自我 2021-01-01 19:50

My code:

string expr = "2+2";
int n = Int32.Parse(expr);
Console.WriteLine(n);

Expected Output: 4.

Output: error, incorrect

相关标签:
回答
  • 消灭零回复
提交回复
热议问题