C# UInt16 CompareTo(UInt16)
Description
UInt16 CompareTo(UInt16)
compares this instance to
a specified 16-bit unsigned integer and returns an indication of their relative
values.
Syntax
UInt16.CompareTo(UInt16)
has the following syntax.
public int CompareTo(
ushort value
)
Parameters
UInt16.CompareTo(UInt16)
has the following parameters.
value
- An unsigned integer to compare.
Returns
UInt16.CompareTo(UInt16)
method returns A signed number indicating the relative values of this instance and value.
Return Value Description 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.
Example
/* www . j a v a2 s. co m*/
using System;
public class MainClass{
public static void Main(String[] argv){
System.Console.WriteLine(UInt16.MinValue.CompareTo((UInt16)123));
}
}
The code above generates the following result.