Convert.ToString Method (Boolean)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Converts the value of the specified Boolean to its equivalent String representation.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- value
- Type: System.Boolean
A Boolean value.
This implementation is identical to Boolean.ToString. It returns Boolean.TrueString for true values and Boolean.FalseString for false values.
The following example illustrates the conversion of a Boolean to a String, using ToString. It also illustrates that the string returned by the conversion equals either Boolean.TrueString or Boolean.FalseString.
bool falseFlag = false; bool trueFlag = true; outputBlock.Text += Convert.ToString(falseFlag) + "\n"; outputBlock.Text += Convert.ToString(falseFlag).Equals(Boolean.FalseString) + "\n"; outputBlock.Text += Convert.ToString(trueFlag) + "\n"; outputBlock.Text += Convert.ToString(trueFlag).Equals(Boolean.TrueString) + "\n"; // The example displays the following output: // False // True // True // True