C# Math Max(SByte, SByte)

Description

Math Max(SByte, SByte) returns the larger of two 8-bit signed integers.

Syntax

Math.Max(SByte, SByte) has the following syntax.


[CLSCompliantAttribute(false)]//from  w  w w .  j  a  v  a2  s . com
public static sbyte Max(
  sbyte val1,
  sbyte val2
)

Parameters

Math.Max(SByte, SByte) has the following parameters.

  • val1 - The first of two 8-bit signed integers to compare.
  • val2 - The second of two 8-bit signed integers to compare.

Returns

Math.Max(SByte, SByte) method returns Parameter val1 or val2, whichever is larger.

Example

The following example demonstrates how to use the Max method to return and display the greater of two variables.


using System;//from w  ww .j  a v  a  2s.  c  om

class Sample 
{
    public static void Main() 
    {
        sbyte    xSbyte1   = 101, xSbyte2  = 111;
        Console.WriteLine(Math.Max(xSbyte1, xSbyte2));
    }
}

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