C# Can a comparison in a String value return a Boolean value. eg. “5 < 10” return true

后端 未结 6 1758
故里飘歌
故里飘歌 2020-12-22 14:11

Is there a way a comparison in a string value can return a Boolean value. Example. If (5 > 5000) would obviously return a false value. But what i wanted to do i

6条回答
  •  抹茶落季
    2020-12-22 14:34

    There is no built-in way to do this.

    Although there are a couple of ways to approach this, one is to simply parse the text yourself. I did this in the code presented in the article A C# Expression Evaluator. You might want to review that code.

提交回复
热议问题