ValuelessJsonDocument<T>
Definition
Namespace: Corvus.Text.Json.Internal
Assembly: Corvus.Text.Json.dll
Source: ValuelessJsonDocument.cs
Represents one of the three "valueless" JSON literals — true, false, and null — whose value is fully determined by its token type and which therefore need no backing buffer at all.
public sealed class ValuelessJsonDocument<T> : IJsonDocument, IDisposable
where T : struct, IJsonElement<T>
Type Parameters
| Parameter | Description |
|---|---|
T |
The type of the root element in the document. |
Remarks
There is exactly one possible true, false, and null value, so this type exposes them as shared BooleanTrue, BooleanFalse, and Null singletons. Each is immutable and allocation-free — safe to hand out from a static readonly field and never dispose. Unlike FixedJsonValueDocument this is not an IWorkspaceManagedDocument and is not pooled: a workspace will never dispose it on reset, so the same singleton can be shared across many workspaces and runs. Dispose is a no-op.
Inheritance
Object → ValuelessJsonDocument
Implements
Properties
| Property | Type | Description |
|---|---|---|
| RootElement | T |
Gets the root element of the document. |
Methods
| Method | Description |
|---|---|
| ToString(int, string?, IFormatProvider?) | Returns the JSON text of the value. |
| TryFormat | Tries to format the value into a character span. |
Fields
| Field | Type | Description |
|---|---|---|
BooleanTrue static |
ValuelessJsonDocument<T> |
The shared true singleton. |
BooleanFalse static |
ValuelessJsonDocument<T> |
The shared false singleton. |
Null static |
ValuelessJsonDocument<T> |
The shared null singleton. |
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