C# | Boolean.ToString() Method Last Updated : 04 Oct, 2021 Comments Improve Suggest changes Like Article Like Report This method is used to convert the value of this instance to its equivalent string representation i.e. either "True" or "False". Syntax: 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: Example 1: C# // C# program to demonstrate // Boolean.ToString() // Method using System; class GFG { // Main Method public static void Main() { // initializing the bool variables bool cat = false; bool dog = true; // getting the value of string property string value1 = cat.ToString(); string value2 = dog.ToString(); // print the string property Console.WriteLine("cat.ToString() returns {0}", value1); Console.WriteLine("dog.ToString() returns {0}", value2); } } Output: cat.ToString() returns False dog.ToString() returns True Example 2: C# // C# program to demonstrate // Boolean.ToString() // Method using System; class GFG { // Main Method public static void Main() { // initializing the bool variables bool alpha = false; bool beta = true; bool gamma = true; bool delta = false; bool theta = true; // calling getValue() method getValue(alpha); getValue(beta); getValue(gamma); getValue(delta); getValue(theta); } // defining getValue() method public static void getValue(bool variable) { // getting the value of string property string value = variable.ToString(); // print the string property Console.WriteLine("{0}", value); } } Output: 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. Reference: https://docs.microsoft.com/en-us/dotnet/api/system.boolean.tostring?view=netframework-4.7.2#System_Boolean_ToString Comment More infoAdvertise with us Next Article C# | Boolean.ToString() Method R rohitprasad3 Follow Improve Article Tags : C# CSharp-method CSharp Boolean Struct Similar Reads C# | Boolean.Parse() Method This method is used to convert the specified string representation of a logical value to its Boolean equivalent. Syntax: public static bool Parse (string value); Here, the value is the string which contains the value to convert.Return Value: This method returns true if value is equivalent to TrueStr 3 min read C# | Char.ToString() Method In C#, Char.ToString() is a System.Char struct method which is used to convert the value of this instance to its equivalent string representation. This method can be overloaded by passing different type of arguments to it. Char.ToString(IFormatProvider) Method Char.ToString(Char) Method Char.ToStrin 2 min read C# | Boolean.TryParse() Method This method is used to convert the specified string representation of a logical value to its Boolean equivalent. It returns a value that indicates whether the conversion succeeded or failed. Syntax: public static bool TryParse (string value, out bool result); Parameters: value: It is a string contai 2 min read Boolean.ToString(IFormatProvider) Method in C# Boolean.ToString(IFormatProvider) Method is used to convert the value of the current instance to its equivalent string representation that is either "True" or "False" Syntax: public string ToString (IFormatProvider provider); Parameters: This method takes an object of type IFormatProvider which is r 1 min read C# | Boolean.Equals(Object) Method Boolean.Equals(Object) Method is used to get a value which indicates whether the current instance is equal to a specified object or not. Syntax: public override bool Equals (object obj); Here, it takes an object to compare with the current instance. Return Value: This method returns true true if obj 2 min read Like