Converts a String to a Double using the specified style.
[Visual Basic] Overloads Public Shared Function Parse( _ ByVal s As String, _ ByVal style As NumberStyles _ ) As Double [C#] public static double Parse( string s, NumberStyles style ); [C++] public: static double Parse( String* s, NumberStyles style ); [JScript] public static function Parse( s : String, style : NumberStyles ) : double;
A Double with the value represented by s.
Exception Type | Condition |
---|---|
ArgumentException | If the style is not a NumberStyles enumeration. |
ArgumentNullException | If the string is a null reference (in Visual Basic Nothing). |
FormatException | If the string is not of the correct format. |
Double numbers are never beyond the scope of Parse. When the numbers are large, they return positive infinity; when they are small, they return negative infinity.
Note that the Parse methods do not accept not a number (NaN), positive infinity, or negative infinity; instead PositiveInfinity, NegativeInfinity, or NaN will be returned. (For addition information, see PositiveInfinity, NegativeInfinity, and NaN.)
The output from ToString should be consumable by FromString.
The numeric format information is obtained from the current locale. (For addition information on cultures, see CultureInfo.)
If s was 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 the Any style of NumberStyles is selected.
The style parameter specifies the permitted style of the numeric string. It must be a combination of bit flags from the NumberStyles enumeration.
Double Structure | Double Members | System Namespace | Double.Parse Overload List | String