This method is used to convert the value of this instance to its equivalent string representation i.e. either “
True” or “
public override string ToString ();
Return Value: This method returns “True” (the value of the TrueString property) if the value of this instance is true, or “False” (the value of the FalseString property) if the value of this instance is false.
Below programs illustrate the use of Boolean.ToString() Method:
cat.ToString() returns False dog.ToString() returns True
False True True False True
Note: XML is case-sensitive, and that the XML specification recognizes “true” and “false” as the valid set of Boolean values. If the string returned by the ToString() method is to be written to an XML file, its String.ToLowerInvariant method should be called first to convert it to lowercase.