Skip to content

JsonElement.TryGetDouble Method

Definition

Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll
Source: JsonElement.cs

TryGetDouble(ref double)

Attempts to represent the current JSON number as a Double.

public bool TryGetDouble(ref double value)

Parameters

Name Type Description
value ref double Receives the value.

Returns

bool

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

Exceptions

Exception Description
InvalidOperationException This value's ValueKind is not Number.
ObjectDisposedException 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 MaxValue (or smaller than MinValue), instead true is returned and PositiveInfinity (or NegativeInfinity) is emitted.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests.

Open an issue