Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

BigInteger.CompareTo Method (Object)

Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.

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

abstract CompareTo : 
        obj:Object -> int  
override CompareTo : 
        obj:Object -> int

Parameters

obj
Type: System.Object

The object to compare.

Return Value

Type: System.Int32
A signed integer that indicates the relationship of the current instance to the obj parameter, as shown in the following table.

Return value

Description

Less than zero

The current instance is less than obj.

Zero

The current instance equals obj.

Greater than zero

The current instance is greater than obj, or the obj parameter is a null reference (Nothing in Visual Basic).

Implements

IComparable.CompareTo(Object)

ExceptionCondition
ArgumentException

obj is not a BigInteger.

This overload of the CompareTo method implements the IComparable.CompareTo method. It is used by non-generic collection objects to order the items in the collection.

The obj parameter must be one of the following:

  • An object whose run-time type is BigInteger.

  • An Object variable whose value is a null reference (Nothing in Visual Basic). If the value of the obj parameter is a null reference (Nothing in Visual Basic), the method returns 1, which indicates that that the current instance is greater than obj.

The following example calls the CompareTo(Object) method to compare a BigInteger value with each element in an object array

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4
Show:
© 2015 Microsoft