NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

FileStream.Flush

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

[Visual Basic]
Overrides Public Sub Flush()
[C#]
public override void Flush();
[C++]
public: override void Flush();
[JScript]
public override function Flush();

Exceptions

Exception Type Condition
IOException An I/O error occurs. For example, an error is thrown when the file is closed.

Remarks

Because a buffer can be used for either reading or writing, but not both simultaneously, Flush performs two functions. First, any data previously written to the buffer is copied to the file and the buffer is cleared.

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

See Also

FileStream Class | FileStream Members | System.IO Namespace