C# Math Min(Int16, Int16)
Description
Math Min(Int16, Int16)
returns the smaller of two 16-bit
signed integers.
Syntax
Math.Min(Int16, Int16)
has the following syntax.
public static short Min(
short val1,
short val2
)
Parameters
Math.Min(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.Min(Int16, Int16)
method returns Parameter val1 or val2, whichever is smaller.
Example
The following example demonstrates how to use the Min method to return and display the smaller of two variables.
using System;/*from w ww . java 2 s .c om*/
class Sample
{
public static void Main()
{
short xShort1 = -2, xShort2 = 52;
Console.WriteLine(Math.Min(xShort1, xShort2));
}
}
The code above generates the following result.