ConvertToDecimal Method (Object, IFormatProvider) |
Converts the value of the specified object to an equivalent decimal number, using the specified culture-specific formatting information.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static decimal ToDecimal(
Object value,
IFormatProvider provider
)
Parameters
- value
- Type: SystemObject
An object that implements the IConvertible interface. - provider
- Type: SystemIFormatProvider
An object that supplies culture-specific formatting information.
Return Value
Type:
DecimalA decimal number that is equivalent to
value, or 0 (zero) if
value is null.
Exceptions Exception | Condition |
---|
FormatException | value is not in an appropriate format for a Decimal type. |
InvalidCastException | value does not implement the IConvertible interface.-or-The conversion is not supported. |
OverflowException | value represents a number that is less than MinValue or greater than MaxValue. |
See Also