C# Decimal Explicit(Decimal to UInt16)
Description
Decimal Explicit(Decimal to UInt16)
defines an explicit
conversion of a Decimal to a 16-bit unsigned integer.
Syntax
Decimal.Explicit(Decimal to UInt16)
has the following syntax.
public static explicit operator ushort (
decimal value
)
Parameters
Decimal.Explicit(Decimal to UInt16)
has the following parameters.
value
- The value to convert.
Returns
Decimal.Explicit(Decimal to UInt16)
method returns A 16-bit unsigned integer that represents the converted Decimal.
Example
The following example converts Decimal numbers to UInt16 values by using the explicit Decimal to UInt16 conversion.
using System;/*from w ww . j a v a2s . c o m*/
class MainClass
{
public static void Main( )
{
object Int16Value;
object UInt16Value;
Int16Value = (short)123.999M;
UInt16Value = (ushort)123.999M;
Console.WriteLine(Int16Value);
Console.WriteLine(UInt16Value );
}
}
The code above generates the following result.