How to convert string to expression
I am having an string "3<2", I would like to use it in a if statement as if(3<2).
How to convert this string into an boolean expression.
Can we convert a string like "a<b" into a boolean expression.
I am having an string "3<2", I would like to use it in a if statement as if(3<2).
How to convert this string into an boolean expression.
Can we convert a string like "a<b" into a boolean expression.
You could use CodeDom - which is used to dynamically build up code (using code) to execute... have a look at the System.CodeDom namespace, in particular the CodeExpressionStatement class.
If you have a look through the documentation (and on the internet for examples) you should be able to put something together.
Hope that helps.
Simon
if (rx.IsMatch(equation))
...
// Work with the matches ("3", "<", "2")