Mono Class Library: System.Decimal Overview | Members

System.Decimal.Compare Method

Compares the values of two decimal values and returns sort order information.

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
public static int Compare (decimal d1, decimal d2)

Parameters

d1
The first value to compare.
d2
The second value to compare.

Returns

The return value is a negative number, zero, or a positive number reflecting the sort order of d1 as compared to d2. Trailing zero digits in the fractional part of are ignored. For non-zero return values, the exact value returned by this method is unspecified. The following table defines the return value. Each comparison compares the numerical values of d1 and d2.

Return Value Meaning
Any negative numberd1< d2
Zerod1 == d2
A positive numberd1>d2

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0