System.IO.FileStream.Flush Method

Clears buffers for this stream and causes any buffered data to be written to the file, and also clears all intermediate file buffers.

Syntax

public virtual void Flush (bool flushToDisk)

Parameters

flushToDisk
true to flush all intermediate file buffers; otherwise, false.

Remarks

Use this overload when you want to ensure that all buffered data in intermediate file buffers is written to disk.

When you call the FileStream.Flush(bool) method, the operating system I/O buffer is also flushed.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0