Using ToString() to Convert to a string : boolean Data Type « Data Type « C# / CSharp Tutorial






class MainClass
{
  static void Main()
  {

    bool boolean = true;
    string text = boolean.ToString();
    // Display "True"
    System.Console.WriteLine(text);

  }
}








2.2.boolean Data Type
2.2.1.The bool Type
2.2.2.Output a boolean variable with Console.WriteLine
2.2.3.bool values in if statement
2.2.4.if statement with bool variable
2.2.5.Declare 3 bools on a single line
2.2.6.Using ToString() to Convert to a string
2.2.7.Generic and nongeneric versions of the CompareTo method for Boolean type