Skip to content

Utf8JsonWriter.Reset Method

Definition

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

Overloads

Method Description
Reset() Resets the Utf8JsonWriter internal state so that it can be re-used.
Reset(Stream) Resets the Utf8JsonWriter internal state so that it can be re-used with the new instance of...
Reset(IBufferWriter<byte>) Resets the Utf8JsonWriter internal state so that it can be re-used with the new instance of...

Reset()

Source: Utf8JsonWriter.cs

Resets the Utf8JsonWriter internal state so that it can be re-used.

public void Reset()

Exceptions

Exception Description
ObjectDisposedException The instance of Utf8JsonWriter has been disposed.

Remarks

The Utf8JsonWriter will continue to use the original writer options and the original output as the destination (either IBufferWriter or Stream).

Applies To

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

Reset(Stream)

Source: Utf8JsonWriter.cs

Resets the Utf8JsonWriter internal state so that it can be re-used with the new instance of Stream.

public void Reset(Stream utf8Json)

Parameters

Name Type Description
utf8Json Stream An instance of Stream used as a destination for writing JSON text into.

Exceptions

Exception Description
ArgumentNullException Thrown when the instance of Stream that is passed in is null.
ObjectDisposedException The instance of Utf8JsonWriter has been disposed.

Remarks

The Utf8JsonWriter will continue to use the original writer options but now write to the passed in Stream as the new destination.

Applies To

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

Reset(IBufferWriter<byte>)

Source: Utf8JsonWriter.cs

Resets the Utf8JsonWriter internal state so that it can be re-used with the new instance of IBufferWriter.

public void Reset(IBufferWriter<byte> bufferWriter)

Parameters

Name Type Description
bufferWriter IBufferWriter<byte> An instance of IBufferWriter used as a destination for writing JSON text into.

Exceptions

Exception Description
ArgumentNullException Thrown when the instance of IBufferWriter that is passed in is null.
ObjectDisposedException The instance of Utf8JsonWriter has been disposed.

Remarks

The Utf8JsonWriter will continue to use the original writer options but now write to the passed in IBufferWriter as the new destination.

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