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.
- Difference between Method Overriding and Method Hiding in C#
- C# | PadLeft() Method
- C# | Math.Sin() Method
- C# | Math.Cos() Method
- C# | Math.Tan() Method
- C# | Join() Method | Set - 1
- C# | ToLower() Method
- Queue.Contains() Method in C#
- TimeSpan.Add() Method in C#
- Decimal.Add() Method in C#
- C# | ToUpper() Method
- Method Hiding in C#
- C# | Copy() Method
- C# | Method Overloading
- C# | IndexOfAny() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.