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# | Math.Min() Method
- C# | Insert() Method
- C# | Replace() Method
- C# | Math.Abs() Method | Set - 2
- C# | IndexOfAny() Method
- C# | Clone() Method
- C# | String.Contains() Method
- C# | Math.Sin() Method
- C# | Math.Cos() Method
- C# | Math.Tan() Method
- C# | IsNullOrEmpty() Method
- C# | Dictionary.Add() Method
- DateTimeOffset.Add() Method in C#
- C# | StartsWith() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.