C# SByte CompareTo(SByte)

Description

SByte CompareTo(SByte) compares this instance to a specified 8-bit signed integer and returns an indication of their relative values.

Syntax

SByte.CompareTo(SByte) has the following syntax.


public int CompareTo(
  sbyte value
)

Parameters

SByte.CompareTo(SByte) has the following parameters.

  • value - An 8-bit signed integer to compare.

Returns

SByte.CompareTo(SByte) method returns A signed integer that indicates the relative order 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.

Example


using System;/*from w  w w.ja  va 2 s  .  c  om*/
public class MainClass{
  public static void Main(String[] argv){  
    System.Console.WriteLine(sbyte.MinValue.CompareTo(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