I know that trying to convert string “0” to boolean will fail, I also know how to fix this, thanks to Jon Skeets answers on other questions.
What I would like to know is WHY does C# not recognize “0” as a valid input for a boolean conversion, surely you could look at it like 0 = false, 1 = true, or even -1 = false and 0 = true, anyways, my logic tells me that it could be a valid input, so is there a very good reason why its not? My bet is old vb6 would be able to recognize the string input “0” as valid.
The simple answer is because that is the way the method is defined. However, in C#
0does not evaluate tofalse, so it would be surprising if “0” were to be converted to false using Convert.