CompareTo Method (Object)
Collapse the table of content
Expand the table of content

Int16.CompareTo Method (Object)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

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

'Declaration
Public Function CompareTo ( _
	value As Object _
) As Integer

Parameters

value
Type: System.Object
An object to compare, or Nothing.

Return Value

Type: System.Int32
A signed number indicating the relative values of this instance and value.

Return Value

Description

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.

-or-

value is Nothing.

Implements

IComparable.CompareTo(Object)

ExceptionCondition
ArgumentException

value is not an Int16.

An Int16, regardless of its value, is considered greater than a null reference.

The value parameter must be Nothing or an instance of Int16; otherwise, an exception is thrown.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft