Converts a String to a Double with the number format and specified style.
[Visual Basic] Overloads Public Shared Function Parse( _ ByVal s As String, _ ByVal style As NumberStyles, _ ByVal info As NumberFormatInfo _ ) As Double [C#] public static double Parse( string s, NumberStyles style, NumberFormatInfo info ); [C++] public: static double Parse( String* s, NumberStyles style, NumberFormatInfo* info ); [JScript] public static function Parse( s : String, style : NumberStyles, info : NumberFormatInfo ) : double;
A Double with the value represented by s.
Exception Type | Condition |
---|---|
ArgumentException | If 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 about culturs, see CultureInfo).
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 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.
The info parameter specifies the NumberFormatInfo instance used to format the string. If the info parameter is null, the numeric format information is obtained from the current locale.
Double Structure | Double Members | System Namespace | Double.Parse Overload List | String