Re: Convert string to bool
Your question was not at all clear. It depends on what you have in your 'string' value.
If you have 'true' or 'false' in your string value then all you need to do to convert the string value to a boolean is as follows:
bool booleanValue = Convert.ToBoolean(myString);
If you have '0' or '1' in your string value then
bool bvalue = (svalue == "1" ? true : false);
is what you need (noting that any value other than '1' will set bvalue to false).
Re: Convert string to bool
Slightly more concise...
Code:
String sValue = "0"; // or "1";
Boolean bValue = sValue.Equals("1");