C# SByte CompareTo(Object)

Description

SByte CompareTo(Object) compares this instance to a specified object and returns an indication of their relative values.

Syntax

SByte.CompareTo(Object) has the following syntax.


public int CompareTo(
  Object obj
)

Parameters

SByte.CompareTo(Object) has the following parameters.

  • obj - An object to compare, or null.

Returns

SByte.CompareTo(Object) method returns 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. -or- obj is null.

Example


using System;//  ww  w . j  a  v  a2 s . c om
public class MainClass{
  public static void Main(String[] argv){  
    System.Console.WriteLine(sbyte.MinValue.CompareTo((object)sbyte.MaxValue));
  }
}
    

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version