Skip to content

Utf8JsonWriter.WriteStringValueSegment Method

Definition

Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll

Overloads

Method Description
WriteStringValueSegment(ReadOnlySpan<char>, bool) Writes the text value segment as a partial JSON string.
WriteStringValueSegment(ReadOnlySpan<byte>, bool) Writes the UTF-8 text value segment as a partial JSON string.

WriteStringValueSegment(ReadOnlySpan<char>, bool)

Source: Utf8JsonWriter.WriteValues.StringSegment.cs

Writes the text value segment as a partial JSON string.

public void WriteStringValueSegment(ReadOnlySpan<char> value, bool isFinalSegment)

Parameters

Name Type Description
value ReadOnlySpan<char> The value to write.
isFinalSegment bool Indicates that this is the final segment of the string.

Exceptions

Exception Description
ArgumentException Thrown when the specified value is too large.
InvalidOperationException Thrown when validation is enabled if this would result in invalid JSON being written or if the previously written segment (if any) was not written with this same overload.

Remarks

The value is escaped before writing.

Applies To

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

WriteStringValueSegment(ReadOnlySpan<byte>, bool)

Source: Utf8JsonWriter.WriteValues.StringSegment.cs

Writes the UTF-8 text value segment as a partial JSON string.

public void WriteStringValueSegment(ReadOnlySpan<byte> value, bool isFinalSegment)

Parameters

Name Type Description
value ReadOnlySpan<byte> The UTF-8 encoded value to be written as a JSON string element of a JSON array.
isFinalSegment bool Indicates that this is the final segment of the string.

Exceptions

Exception Description
ArgumentException Thrown when the specified value is too large.
InvalidOperationException Thrown when validation is enabled if this would result in invalid JSON being written or if the previously written segment (if any) was not written with this same overload.

Remarks

The value is escaped before writing.

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