C# Boolean CompareTo(Object)
Description
Boolean CompareTo(Object)
compares this instance to
a specified object and returns an integer that indicates their relationship
to one another.
Syntax
Boolean.CompareTo(Object)
has the following syntax.
public int CompareTo(
Object obj
)
Parameters
Boolean.CompareTo(Object)
has the following parameters.
obj
- An object to compare to this instance, or null.
Returns
Boolean.CompareTo(Object)
method returns A signed integer that
indicates the relative order of this instance and obj.
Example
The following code example demonstrates Boolean.CompareTo(Object).
using System;// ww w . j a va2s. co m
class Sample
{
public static void Main()
{
Boolean a1 = true;
Object a2 = true;
Console.WriteLine(a1.CompareTo(a2));
}
}
The code above generates the following result.