Export (0) Print
Expand All

Decimal.IComparable.CompareTo Method

.NET Framework 4.5

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

Namespace:  System
Assembly:  System.Runtime (in System.Runtime.dll)

private abstract CompareTo : 
        value:Object -> int  
private override CompareTo : 
        value:Object -> int


Type: System.Object

The object to compare with this instance, or a null reference (Nothing in Visual Basic).

Return Value

Type: System.Int32
A signed integer that indicates the relative order of this instance and value.

Return value


Less than zero

This instance precedes value in the sort order.


This instance occurs in the same position as value in the sort order.

Greater than zero

This instance follows value in the sort order.


value is a null reference (Nothing in Visual Basic).




value is not a Decimal.

This member is an explicit interface implementation. It can be used only when the Decimal instance is cast to an IComparable interface.

.NET Framework

Supported in: 4.6

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8
© 2014 Microsoft