This method is used to compare this instance to a specified 8-bit unsigned integer and returns an indication of their relative values.
public int CompareTo (byte value);
Here, the value is an 8-bit unsigned integer to compare.
Return Value: This method returns a signed integer that indicates the relative order of this instance and value.
- Less than zero: This instance is less than value.
- Zero: This instance is equal to value.
- Greater than zero: This instance is greater than value.
Below programs illustrate the use of Byte.CompareTo(Byte) Method:
val2 is greater than val1
10 is less than 20 30 is greater than 20 10 is equal to 10 5 is less than 7 40 is less than 50 1 is less than 2
- Difference between Method Overriding and Method Hiding in C#
- C# | Copy() Method
- C# | ToLower() Method
- Stack.Pop() Method in C#
- C# | StartsWith() Method
- C# | ToUpper() Method
- C# | SortedDictionary.Add() Method
- Stack.Contains() Method in C#
- C# | Join() Method | Set - 1
- C# | PadLeft() Method
- C# | IsNullOrEmpty() Method
- C# | Math.Abs() Method | Set - 2
- C# | Math.Abs() Method | Set - 1
- C# | Math.Log() Method
- C# | Method Parameters
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.