Skip to content

Utf8JsonReader.ValueSpan Property

Definition

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

ValueSpan()

Gets the value of the last processed token as a ReadOnlySpan slice of the input payload. If the JSON is provided within a ReadOnlySequence and the slice that represents the token value fits in a single segment, then ValueSpan will contain the sliced value since it can be represented as a span. Otherwise, the ValueSequence will contain the token value.

public ReadOnlySpan<byte> ValueSpan { get; set; }

Returns

ReadOnlySpan<byte>

Remarks

If HasValueSequence is true, ValueSpan contains useless data, likely for a previous single-segment token. Therefore, only access ValueSpan if HasValueSequence is false. Otherwise, the token value must be accessed from ValueSequence.

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