Utf8JsonWriter.DisposeAsync 方法

定义

异步提交尚未刷新的所有剩余 JSON 文本,并释放当前实例使用的所有资源。Asynchronously commits any leftover JSON text that has not yet been flushed and releases all resources used by the current instance.

public:
 virtual System::Threading::Tasks::ValueTask DisposeAsync();
public System.Threading.Tasks.ValueTask DisposeAsync ();
abstract member DisposeAsync : unit -> System.Threading.Tasks.ValueTask
override this.DisposeAsync : unit -> System.Threading.Tasks.ValueTask
Public Function DisposeAsync () As ValueTask

返回

ValueTask

表示异步释放操作的任务。A task representing the asynchronous dispose operation.

实现

注解

对于 IBufferWriter,这将 IBufferWriter<T> 基于迄今为止编写的内容来改进基础。In the case of IBufferWriter, this advances the underlying IBufferWriter<T> based on what has been written so far.

对于 Stream,这会将数据写入流并对其进行刷新。In the case of Stream, this writes the data to the stream and flushes it.

Utf8JsonWriter无法在释放后重用该实例。The Utf8JsonWriter instance cannot be reused after disposing.

适用于