System.Int16.CompareTo Method

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 object.

Syntax

public int CompareTo (object value)

Parameters

value
An object to compare, or null.

Returns

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.

-or-

value is null.

Exceptions

TypeReason
ArgumentException value is not a short and is not a null reference.

Remarks

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

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

Requirements

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