Click or drag to resize
DoubleTryParse Method (String, NumberStyles, IFormatProvider, Double)
Converts the string representation of a number in a specified style and culture-specific format to its double-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static bool TryParse(
	string s,
	NumberStyles style,
	IFormatProvider provider,
	out double result
)

Parameters

s
Type: SystemString
A string containing a number to convert.
style
Type: System.GlobalizationNumberStyles
A bitwise combination of NumberStyles values that indicates the permitted format of s. A typical value to specify is Float combined with AllowThousands.
provider
Type: SystemIFormatProvider
An IFormatProvider that supplies culture-specific formatting information about s.
result
Type: SystemDouble
When this method returns, contains a double-precision floating-point number equivalent to the numeric value or symbol contained in s, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is null, is not in a format compliant with style, represents a number less than MinValue or greater than MaxValue, or if style is not a valid combination of NumberStyles enumerated constants. This parameter is passed uninitialized.

Return Value

Type: Boolean
true if s was converted successfully; otherwise, false.
Exceptions
ExceptionCondition
ArgumentExceptionstyle is not a NumberStyles value. -or-style includes the AllowHexSpecifier value.
See Also