C# Math Max(UInt16, UInt16)
Description
Math Max(UInt16, UInt16)
returns the larger of two 16-bit
unsigned integers.
Syntax
Math.Max(UInt16, UInt16)
has the following syntax.
[CLSCompliantAttribute(false)]// www.ja v a 2 s . c o m
public static ushort Max(
ushort val1,
ushort val2
)
Parameters
Math.Max(UInt16, UInt16)
has the following parameters.
val1
- The first of two 16-bit unsigned integers to compare.val2
- The second of two 16-bit unsigned integers to compare.
Returns
Math.Max(UInt16, UInt16)
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;
/*from w w w .j a v a 2 s.c o m*/
class Sample
{
public static void Main()
{
ushort xUshort1 = 102, xUshort2 = 112;
Console.WriteLine(Math.Max(xUshort1, xUshort2));
}
}
The code above generates the following result.