Skip to content

Utf8JsonWriter.FlushAsync Method

Definition

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

FlushAsync(CancellationToken)

Asynchronously commits the JSON text written so far which makes it visible to the output destination.

public Task FlushAsync(CancellationToken cancellationToken)

Parameters

Name Type Description
cancellationToken CancellationToken (optional)

Returns

Task

Exceptions

Exception Description
ObjectDisposedException The instance of Utf8JsonWriter has been disposed.

Remarks

In the case of IBufferWriter, this advances the underlying IBufferWriter based on what has been written so far. In the case of Stream, this writes the data to the stream and flushes it asynchronously, while monitoring cancellation requests.

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