To compare two values, use the CompareTo() method.
The following are the return values −
Here is the code to implement CompareTo() method in C# −
using System; public class Demo { public static void Main() { int val1 = 100; int val2 = 100; int res = val1.CompareTo(val2); Console.WriteLine(res); } }
0