Compares this instance to a specified decimal object and returns a comparison of their relative values.
A signed number indicating the relative values 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.
This method implements the IComparable`1 interface and performs slightly better than the decimal.CompareTo(object) method because it does not have to convert the value parameter to an object.
Depending on your programming language, it might be possible to code a erload:System.Decimal.CompareTo method where the parameter type has fewer bits (is narrower) than the instance type. This is possible because some programming languages perform an implicit widening conversion that represents the parameter as a type with as many bits as the instance.
For example, suppose the instance type is int and the parameter type is byte. The Microsoft C# compiler generates instructions to represent the parameter as an int object, then generates a int.CompareTo(int) method to compare the values of the int instance and the int parameter representation.
Consult your programming language's documentation to determine whether its compiler performs implicit widening conversions on numeric types.