Generic and nongeneric versions of the CompareTo method for Boolean type : boolean Data Type « Data Type « C# / CSharp Tutorial






using System;

class Sample 
{
    public static void Main() 
    {
        Boolean  a1 = true,  a2 = true;


        Console.WriteLine(a1.CompareTo(a2));
        Console.WriteLine(a1.CompareTo((Object)a2));

    }

}








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