Syntax:
public int CompareTo(char value)
Parameters Type Meaning
value System.Char A Char object to compare.
Return Value Description
Less than zero This instance precedes value.
Zero This instance has the same position in the sort order as value.
Greater than zero This instance follows value.
using System;
class Sample
{
public static void Main()
{
char ch='A';
int result = ch.CompareTo('B');
Console.WriteLine(result);
}
}
The output:
-1