[Solved] how to parse an input string such as “4>1”, resolve the expression and return boolean [duplicate]

There is no easy answer For starters there are no easy solutions. I noticed somebody mentioning Boolean.valueOf(…); The goal of the Boolean.valueOf(String) method is not to evaluate conditions or equations. It is just a simple method to convert a String with value “true” or “false” to a Boolean object. Anyway, if you want this kind … Read more

[Solved] Can you determine the terminating boolean expression of a for loop dynamically?

You can replace the condition in a loop with a delegate. Something like this works: int i = 0; Func<bool> predicate = () => i < 5; for (; predicate(); ++i) Console.WriteLine(i); Just assign a different delegate to predicate if you want a different condition. EDIT: This might be a clearer example: Func<int, bool> countToFive … Read more