This documentation is archived and is not being maintained.

SByte.CompareTo Method

Compares this instance to a specified object and returns an indication of their relative values.

The SByte type is not CLS-compliant. The CLS-compliant alternative type is Int16. For more information about CLS compliance, see What is the Common Language Specification.

[Visual Basic]
Public Overridable Function CompareTo( _
   ByVal obj As Object _
) As Integer
public virtual int CompareTo(
 object obj
public: virtual int CompareTo(
 Object* obj
public function CompareTo(
   obj : Object
) : int;


An object to compare, or a null reference (Nothing in Visual Basic).

Return Value

A signed number indicating the relative values of this instance and obj.

Return Value Description
Less than zero This instance is less than obj.
Zero This instance is equal to obj.
Greater than zero This instance is greater than obj.


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


Exception Type Condition
ArgumentException obj is not an SByte.


Any instance of SByte, regardless of its value, is considered greater than a null reference (Nothing in Visual Basic).

The obj parameter must be a null reference (Nothing) or an instance of SByte; otherwise, an exception is thrown.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

SByte Structure | SByte Members | System Namespace | Byte | Equals