C# Decimal Explicit(Decimal to Int32)
Description
Decimal Explicit(Decimal to Int32)
defines an explicit
conversion of a Decimal to a 32-bit signed integer.
Syntax
Decimal.Explicit(Decimal to Int32)
has the following syntax.
public static explicit operator int (
decimal value
)
Parameters
Decimal.Explicit(Decimal to Int32)
has the following parameters.
value
- The value to convert.
Returns
Decimal.Explicit(Decimal to Int32)
method returns A 32-bit signed integer that represents the converted Decimal.
Example
The following example converts Decimal numbers to Int32 values by using the explicit Decimal to Int32 conversion.
using System;/*from w w w . j av a 2 s. c o m*/
class MainClass
{
public static void Main( )
{
object Int32Value;
object UInt32Value;
Int32Value = (int)123.999M;
UInt32Value = (uint)123.999M;
Console.WriteLine( Int32Value);
Console.WriteLine( UInt32Value );
}
}
The code above generates the following result.