C# Math Min(UInt16, UInt16)

Description

Math Min(UInt16, UInt16) returns the smaller of two 16-bit unsigned integers.

Syntax

Math.Min(UInt16, UInt16) has the following syntax.


[CLSCompliantAttribute(false)]/*from  w  ww . j a v  a 2s  .  c om*/
public static ushort Min(
  ushort val1,
  ushort val2
)

Parameters

Math.Min(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.Min(UInt16, UInt16) 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;/*  ww  w .j  a  v a 2  s.  c  o m*/

class Sample 
{
    public static void Main() 
    {
        ushort   xUshort1  = 102, xUshort2 = 112;
        Console.WriteLine(Math.Min(xUshort1, xUshort2));
    }
}

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