This method converts a specified String to a Currency object with a specified style.
[Visual Basic] Overloads Public Shared Function Parse( _ ByVal s As String, _ ByVal style As NumberStyles _ ) As Currency [C#] public static Currency Parse( string s, NumberStyles style ); [C++] public: static Currency Parse( String* s, NumberStyles style ); [JScript] public static function Parse( s : String, style : NumberStyles ) : Currency;
A Currency with the value represented by the string.
Exception Type | Condition |
---|---|
ArgumentNullException | If the string is null. |
ArgumentException | If style is not a combination of bit flags from the NumberStyles enumeration. |
FormatException | If the stering is not of the correct format. |
OverflowException | If the string represents a number that is outside the expected range. |
The Parse method converts (parses) a string to a Currency and applies a specified format style.
Note that the Parse methods do not accept NaN or positve or negative infinity.
The numeric format information (a NumberFormatInfo) is obtained from the locale of the current thread.
If s has been created by one of the Format methods using C, D, E, F, G, or N as the format specifier, it is guaranteed that s can be parsed when style is NumberStyles.Any.
The style parameter must be a combination of bit flags from the NumberStyles enumeration.An overflow exception is thrown if the string represents a number that is less than MinValue or greater than MaxValue
Currency Structure | Currency Members | System Namespace | Currency.Parse Overload List