C# Decimal ToInt16
Description
Decimal ToInt16
converts the value of the specified Decimal
to the equivalent 16-bit signed integer.
Syntax
Decimal.ToInt16
has the following syntax.
public static short ToInt16(
decimal value
)
Parameters
Decimal.ToInt16
has the following parameters.
value
- The decimal number to convert.
Returns
Decimal.ToInt16
method returns A 16-bit signed integer equivalent to value.
Example
The following example uses the ToInt16 method to convert decimal numbers to Int16 values.
/*from w w w.ja va 2 s . co m*/
using System;
class Example
{
public static void Main( )
{
short number = Decimal.ToInt16(32767.999m);
Console.WriteLine(number);
}
}
The code above generates the following result.