Double::Parse Method (String^, NumberStyles)
Converts the string representation of a number in a specified style to its doubleprecision floatingpoint number equivalent.
Assembly: mscorlib (in mscorlib.dll)
Parameters
 s

Type:
System::String^
A string that contains a number to convert.
 style

Type:
System.Globalization::NumberStyles
A bitwise combination of enumeration values that indicate the style elements that can be present in s. A typical value to specify is a combination of Float combined with AllowThousands.
Return Value
Type: System::DoubleA doubleprecision floatingpoint number that is equivalent to the numeric value or symbol specified in s.
Exception  Condition 

ArgumentNullException  s is null. 
FormatException  s does not represent a number in a valid format. 
OverflowException  
ArgumentException 
The style parameter defines the style elements (such as white space, thousands separators, and currency symbols) that are allowed in the s parameter for the parse operation to succeed. It must be a combination of bit flags from the NumberStyles enumeration. The following NumberStyles members are not supported:
The s parameter can contain the current culture's NumberFormatInfo::PositiveInfinitySymbol, NumberFormatInfo::NegativeInfinitySymbol, or NumberFormatInfo::NaNSymbol. Depending on the value of style, it can also take the form:
[ws][$][sign][integraldigits[,]]integraldigits[.[fractionaldigits]][E[sign]exponentialdigits][ws]
Elements in square brackets ([ and ]) are optional. The following table describes each element.
Element  Description 

ws  A series of whitespace characters. White space can appear at the beginning of s if style includes the NumberStyles::AllowLeadingWhite flag, and it can appear at the end of s if style includes the NumberStyles::AllowTrailingWhite flag. 
$  A culturespecific currency symbol. Its position in the string is defined by the NumberFormatInfo::CurrencyNegativePattern and NumberFormatInfo::CurrencyPositivePattern properties of the current culture. The current culture's currency symbol can appear in s if style includes the NumberStyles::AllowCurrencySymbol flag. 
sign  A negative sign symbol () or a positive sign symbol (+). The sign can appear at the beginning of s if style includes the NumberStyles::AllowLeadingSign flag, and it can appear at the end of s if style includes the NumberStyles::AllowTrailingSign flag. Parentheses can be used in s to indicate a negative value if style includes the NumberStyles::AllowParentheses flag. 
integraldigits  A series of digits ranging from 0 to 9 that specify the integral part of the number. The integraldigits element can be absent if the string contains the fractionaldigits element. 
,  A culturespecific group separator. The current culture's group separator symbol can appear in s if style includes the NumberStyles::AllowThousands flag 
.  A culturespecific decimal point symbol. The current culture's decimal point symbol can appear in s if style includes the NumberStyles::AllowDecimalPoint flag. 
fractionaldigits  A series of digits ranging from 0 to 9 that specify the fractional part of the number. Fractional digits can appear in s if style includes the NumberStyles::AllowDecimalPoint flag. 
E  The "e" or "E" character, which indicates that the value is represented in exponential (scientific) notation. The s parameter can represent a number in exponential notation if style includes the NumberStyles::AllowExponent flag. 
exponentialdigits  A series of digits ranging from 0 to 9 that specify an exponent. 
A string with digits only (which corresponds to the NumberStyles::None style) always parses successfully. The remaining System.Globalization::NumberStyles members control elements that may be present, but are not required to be present, in the input string. The following table indicates how individual NumberStyles flags affect the elements that may be present in s.
NumberStyles value  Elements permitted in s in addition to digits 

The integraldigits element only.  
The decimal point (.) and fractionaldigits elements.  
The "e" or "E" character, which indicates exponential notation. This flag by itself supports values in the form digitsEdigits; additional flags are needed to successfully parse strings with such elements as positive or negative signs and decimal point symbols.  
The ws element at the beginning of s.  
The ws element at the end of s.  
The sign element at the beginning of s.  
The sign element at the end of s.  
The sign element in the form of parentheses enclosing the numeric value.  
The thousands separator (,) element.  
The currency ($) element.  
All elements. However, s cannot represent a hexadecimal number or a number in exponential notation.  
The ws element at the beginning or end of s, sign at the beginning of s, and the decimal point (.) symbol. The s parameter can also use exponential notation.  
The ws, sign, thousands separator (,) and decimal point (.) elements.  
All elements. However, s cannot represent a hexadecimal number. 
The s parameter is parsed using the formatting information in a NumberFormatInfo object that is initialized for the current system culture. For more information, see CurrentInfo.
Ordinarily, if you pass the Double::Parse method a string that is created by calling the Double::ToString method, the original Double value is returned. However, because of a loss of precision, the values may not be equal. In addition, attempting to parse the string representation of either MinValue or MaxValue throws an OverflowException, as the following example illustrates.
If a separator is encountered in the s parameter during a parse operation, and the applicable currency or number decimal and group separators are the same, the parse operation assumes that the separator is a decimal separator rather than a group separator. For more information about separators, see CurrencyDecimalSeparator, NumberDecimalSeparator, CurrencyGroupSeparator, and NumberGroupSeparator.
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1