C# Convert ToInt32(Decimal)
Description
Convert ToInt32(Decimal)
converts the value of the specified
decimal number to an equivalent 32-bit signed integer.
Syntax
Convert.ToInt32(Decimal)
has the following syntax.
public static int ToInt32(
decimal value
)
Parameters
Convert.ToInt32(Decimal)
has the following parameters.
value
- The decimal number to convert.
Returns
Convert.ToInt32(Decimal)
method returns value, rounded to the nearest 32-bit signed integer. If value is halfway
between two whole numbers, the even number is returned; that is, 4.5 is converted
to 4, and 5.5 is converted to 6.
Example
//from w w w. j a v a 2 s.com
using System;
public class MainClass{
public static void Main(String[] argv){
Console.WriteLine(Convert.ToInt32(123.123M));
}
}
The code above generates the following result.