Bewerken

Share via


JsonElement.TryGetDouble(Double) Method

Definition

Attempts to represent the current JSON number as a Double.

public:
 bool TryGetDouble([Runtime::InteropServices::Out] double % value);
public bool TryGetDouble (out double value);
member this.TryGetDouble : double -> bool
Public Function TryGetDouble (ByRef value As Double) As Boolean

Parameters

value
Double

When this method returns, contains a double-precision floating point value equivalent to the current JSON number if the conversion succeeded, or 0 if the conversion failed.

Returns

true if the number can be represented as a Double; otherwise, false.

Exceptions

The parent JsonDocument has been disposed.

Remarks

This method does not parse the contents of a JSON string value.

On .NET Core, this method does not return false for values larger than Double.MaxValue or smaller than Double.MinValue. Instead, it returns true and assigns Double.PositiveInfinity or Double.NegativeInfinity to value.

Applies to