C# Decimal ToInt32
Description
Decimal ToInt32
converts the value of the specified Decimal
to the equivalent 32-bit signed integer.
Syntax
Decimal.ToInt32
has the following syntax.
public static int ToInt32(
decimal d
)
Parameters
Decimal.ToInt32
has the following parameters.
d
- The decimal number to convert.
Returns
Decimal.ToInt32
method returns A 32-bit signed integer equivalent to the value of d.
Example
The following example uses the ToInt32 method to convert decimal numbers to Int32 values.
/*w w w . jav a2 s . c o m*/
using System;
class Example
{
public static void Main( )
{
int number = Decimal.ToInt32(123.999m);
Console.WriteLine(number);
}
}
The code above generates the following result.