JsonElement.GetSingle Method
Definition
Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll
Source: JsonElement.cs
GetSingle()
Gets the current JSON number as a Single.
public float GetSingle()
Returns
The current JSON number as a Single.
Exceptions
| Exception | Description |
|---|---|
InvalidOperationException |
This value's ValueKind is not Number. |
FormatException |
The value cannot be represented as a Single. |
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 returns PositiveInfinity (or NegativeInfinity) for values larger than MaxValue (or smaller than MinValue).
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