FixedJsonValueDocument<T>
Definition
Namespace: Corvus.Text.Json.Internal
Assembly: Corvus.Text.Json.dll
Source: FixedJsonValueDocument.cs
Represents a JSON document backed by a fixed simple value (number or string).
public sealed class FixedJsonValueDocument<T> : IJsonDocument, IDisposable, IWorkspaceManagedDocument
where T : struct, IJsonElement<T>
Type Parameters
| Parameter | Description |
|---|---|
T |
The type of the root element in the document. |
Remarks
This type uses a thread-local pool to avoid allocations for intermediate values produced during expression evaluation (e.g., arithmetic results, string concatenation results). Each instance wraps the raw UTF-8 JSON representation of a single value. For numbers, the raw value is the unquoted number text (e.g., 123.45). For strings, the raw value is the quoted string text (e.g., "hello").
Inheritance
Object → FixedJsonValueDocument
Implements
IJsonDocument, IDisposable, IWorkspaceManagedDocument
Properties
| Property | Type | Description |
|---|---|---|
| RootElement | T |
Gets the root element of the document. |
Methods
| Method | Description |
|---|---|
ForNumber(ReadOnlyMemory<byte>) static |
Creates a FixedJsonValueDocument for a number value, using the pool. |
ForNumberFromSpan(ReadOnlySpan<byte>) static |
Creates a FixedJsonValueDocument for a number value from a span, copying the data into the document's internal buffer (zero heap... |
ForString(ReadOnlyMemory<byte>) static |
Creates a FixedJsonValueDocument for a string value, using the pool. |
ForStringFromSpan(ReadOnlySpan<byte>) static |
Creates a FixedJsonValueDocument for a string value from a span, copying the data into the document's internal buffer (zero heap... |
| ToString(int, string, IFormatProvider) | |
| TryFormat |
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