C# Math Max(Int16, Int16)
Description
Math Max(Int16, Int16)
returns the larger of two 16-bit
signed integers.
Syntax
Math.Max(Int16, Int16)
has the following syntax.
public static short Max(
short val1,
short val2
)
Parameters
Math.Max(Int16, Int16)
has the following parameters.
val1
- The first of two 16-bit signed integers to compare.val2
- The second of two 16-bit signed integers to compare.
Returns
Math.Max(Int16, Int16)
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;// w w w . jav a 2s . c o m
class Sample
{
public static void Main()
{
short xShort1 = -2, xShort2 = 52;
Console.WriteLine(Math.Max(xShort1, xShort2));
}
}
The code above generates the following result.