c# - Why does Convert.ToBoolean("0") fail? -


I know that the string "0" must be tried to convert to boolean, I also know how to do it Thanks to John, Skeets responds to other questions.

What I would like to know is why the C # boolean does not recognize "0" as a valid input for conversion, of course you can see it equal to 0 = wrong, 1 = true or -1 = False and 0 = true, anyway, my argument tells me that it can be a valid input, so its a good reason that it is not the reason? My condition will be able to assume the old vb6 string input as "0" valid.

Simple answer is because this method is defined method. However, in C # 0 the false is not evaluated, so it would be amazing that "0" would be converted incorrectly using Convert.


Comments