Compares specified Decimal values.
[Visual Basic] Public Shared Function Compare( _ ByVal d1 As Decimal, _ ByVal d2 As Decimal _ ) As Integer [C#] public static int Compare( Decimal d1, Decimal d2 ); [C++] public: static int Compare( Decimal d1, Decimal d2 ); [JScript] public static function Compare( d1 : Decimal, d2 : Decimal ) : int;
Value | Description |
---|---|
-1 | If the first number is less than the second number. |
0 | If the numbers are equal. |
1 | If the first number is greater than the second number. |
The Compare method compares two decimal values and returns an integer that represents the relationship between the values.
For example: if the first value is less than the second, then a negative one is returned. If the first value is equal the second, then a zero is returned. If the first value is more than the second, then a one is returned. The relationship can be expressed by the following:
-1 if d1 < d2,
0 if d1 = d2, or
1 if d1 > d2.