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);
[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.

備註

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

如果衍生類別( DeflateStream例如或GZipStream)不會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();
[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.

備註

如果衍生類別( DeflateStream例如或GZipStream)不會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.

適用於