Stream.FlushAsync 方法

定義

以非同步的方式清除這個資料流的所有緩衝區,並造成所有緩衝資料都寫入基礎裝置。Asynchronously clears all buffers for this stream and causes any buffered data to be written to the underlying device.

多載

FlushAsync(CancellationToken)

以非同步的方式清除這個資料流的所有緩衝區,造成所有緩衝資料都寫入基礎裝置,並且監視取消要求。Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.

FlushAsync()

以非同步的方式清除這個資料流的所有緩衝區,並造成所有緩衝資料都寫入基礎裝置。Asynchronously clears all buffers for this stream and causes any buffered data to be written to the underlying device.

FlushAsync(CancellationToken)

以非同步的方式清除這個資料流的所有緩衝區,造成所有緩衝資料都寫入基礎裝置,並且監視取消要求。Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.

public:
 virtual System::Threading::Tasks::Task ^ FlushAsync(System::Threading::CancellationToken cancellationToken);
public virtual System.Threading.Tasks.Task FlushAsync (System.Threading.CancellationToken cancellationToken);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual System.Threading.Tasks.Task FlushAsync (System.Threading.CancellationToken cancellationToken);
abstract member FlushAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.FlushAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task

參數

cancellationToken
CancellationToken

用於監控取消要求的權杖。The token to monitor for cancellation requests. 預設值是 NoneThe default value is None.

傳回

表示非同步排清作業的工作。A task that represents the asynchronous flush operation.

屬性

例外狀況

資料流已經處置。The stream has been disposed.

備註

如果作業在完成前取消,則傳回的工作會包含 Status 屬性的 Canceled 值。If the operation is canceled before it completes, the returned task contains the Canceled value for the Status property.

如果衍生類別(例如 DeflateStreamGZipStream)不會在其 Flush 方法的執行中排清緩衝區,則 FlushAsync 方法不會排清緩衝區。If a derived class, such as DeflateStream or GZipStream, does not flush the buffer in its implementation of the Flush method, the FlushAsync method will not flush the buffer.

另請參閱

FlushAsync()

以非同步的方式清除這個資料流的所有緩衝區,並造成所有緩衝資料都寫入基礎裝置。Asynchronously clears all buffers for this stream and causes any buffered data to be written to the underlying device.

public:
 System::Threading::Tasks::Task ^ FlushAsync();
public System.Threading.Tasks.Task FlushAsync ();
[System.Runtime.InteropServices.ComVisible(false)]
public System.Threading.Tasks.Task FlushAsync ();
member this.FlushAsync : unit -> System.Threading.Tasks.Task
Public Function FlushAsync () As Task

傳回

表示非同步排清作業的工作。A task that represents the asynchronous flush operation.

屬性

例外狀況

資料流已經處置。The stream has been disposed.

備註

如果衍生類別(例如 DeflateStreamGZipStream)不會在其 Flush 方法的執行中排清緩衝區,則 FlushAsync 方法不會排清緩衝區。If a derived class, such as DeflateStream or GZipStream, does not flush the buffer in its implementation of the Flush method, the FlushAsync method will not flush the buffer.

適用於