C# Math Max(Byte, Byte)

Description

Math Max(Byte, Byte) returns the larger of two 8-bit unsigned integers.

Syntax

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


public static byte Max(
  byte val1,
  byte val2
)

Parameters

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

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

Returns

Math.Max(Byte, Byte) 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.


// This example demonstrates Math.Max() 
using System;
// w  ww. jav a 2 s. com
class Sample 
{
    public static void Main() 
    {
        byte     xByte1    = 1,    xByte2    = 51;  
        Console.WriteLine(Math.Max(xByte1, xByte2));
    }
}

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