Mono Class Library: System.IO.FileStream Overview | Members

System.IO.FileStream.Flush Method

Updates the underlying file with the current state of the buffer and subsequently clears the buffer.

public override void Flush ()

Exceptions

TypeReason
System.IO.IOExceptionAn I/O error occurred.
ObjectDisposedExceptionThe current instance has already been closed.

Remarks

A System.IO.FileStream buffer can be used either for reading or writing. If data was copied to the buffer for writing, it is written to the file and the buffer is cleared.

If data was copied to the buffer for reading, and the Stream.CanSeek property is true, the current position within the file is decremented by the number of unread bytes in the buffer. The buffer is then cleared.

Note: This method overrides Stream.Flush.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0