Converts a Decimal to an Int32 with the default format.
[Visual Basic] Overloads Overridable Public Function ToInt32() As Integer [C#] public virtual int ToInt32(); [C++] public: virtual int ToInt32(); [JScript] public function ToInt32() : int;
The result's of converting the argument to an integer.
Exception Type | Condition |
---|---|
OverflowException | is thrown if the resulting integer value is less than Int32.MinValue or greater than Int32.MaxValue. |
The ToInt32 method returns an int. It returns a 32-bit, 4-byte signed integer with the converted number.
The Decimal value is rounded toward zero to the nearest integer value, and the result of this operation is returned as an integer.
This method implements IConvertible, which replaced IValue. This method is used to obtain the type code for a specified object. (See Convert and Value for more information about conversions; see the Type for more information about types.)
Decimal Structure | Decimal Members | System Namespace | Decimal.ToInt32 Overload List