ConvertToDecimal Method (String, IFormatProvider) |
Converts the specified string representation of a number 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(
string value,
IFormatProvider provider
)
Parameters
- value
- Type: SystemString
A string that contains a number to convert. - provider
- Type: SystemIFormatProvider
An object that supplies culture-specific formatting information.
Return Value
Type:
DecimalA decimal number that is equivalent to the number in
value, or 0 (zero) if
value is null.
Exceptions Exception | Condition |
---|
FormatException | value is not a number in a valid format. |
OverflowException | value represents a number that is less than MinValue or greater than MaxValue. |
See Also