Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Converts the string representation of a number 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)
Syntax
'Declaration
Public Shared Function TryParse ( _
s As String, _
<OutAttribute> ByRef result As Double _
) As Boolean
public static bool TryParse(
string s,
out double result
)
public:
static bool TryParse(
String^ s,
[OutAttribute] double% result
)
static member TryParse :
s:string *
result:float byref -> bool
public static function TryParse(
s : String,
result : double
) : boolean
Parameters
- s
Type: System. . :: . .String
A string containing a number to convert.
- result
Type: System. . :: . .Double%
When this method returns, contains the double-precision floating-point number equivalent to the s parameter, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is nullNothingnullptrunita null reference (Nothing in Visual Basic), is not a number in a valid format, or represents a number less than MinValue or greater than MaxValue. This parameter is passed uninitialized.
Return Value
Type: System. . :: . .Boolean
true if s was converted successfully; otherwise, false.
Remarks
This overload differs from the Double..::..Parse(String) method by returning a Boolean value that indicates whether the parse operation succeeded instead of returning the parsed numeric value. It eliminates the need to use exception handling to test for a FormatException in the event that s is invalid and cannot be successfully parsed.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.