Dela via


IDataWriter.FlushAsync Method

Definition

Flushes data asynchronously.

public:
 IAsyncOperation<bool> ^ FlushAsync();
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<bool> FlushAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<bool> FlushAsync();
function flushAsync()
Public Function FlushAsync () As IAsyncOperation(Of Boolean)

Returns

The stream flush operation.

Attributes

Remarks

The FlushAsync method ensures that the data has reached the target storage medium that the stream represents. For example, to improve application responsiveness and throughput, a file stream might respond to a write operation by copying the buffer into another temporary storage medium and returning immediately, while the target device begins writing the data concurrently.

The FlushAsync method doesn't complete until all data specified in previous write calls has reached the target storage medium. If the data can't be written, or an error occurred during a write operation, the method returns false.

The FlushAsync method may produce latencies and does not always guarantee durable and coherent storage of data. It's generally recommended to avoid this method if possible.

Applies to