The Boolean.ToString() method in C# converts the value of this instance to its equivalent string representation (either "True" or "False").
Syntax
Following is the syntax −
public override string ToString ();
Example
Let us now see an example to implement the Boolean.ToString() method −
using System;
public class Demo {
public static void Main(){
bool b = true;
string res = b.ToString();
Console.WriteLine("Return Value = "+res);
}
}Output
This will produce the following output −
Return Value = True
Example
Let us now see another example to implement the Boolean.ToString() method −
using System;
public class Demo {
public static void Main(){
bool b = false;
string res = b.ToString();
Console.WriteLine("Return Value = "+res);
}
}Output
This will produce the following output −
Return Value = False