Does binarywriter.flush () also clear the main filter object?

I have a code snippet as follows:

Dim fstream = new filestream(some file here)
dim bwriter = new binarywriter(fstream)
while not end of file
    read from source file
    bwriter.write()
    bwriter.flush()
end while

My question is the following. When I call bwriter.flush (), does it also clear the fstream object? Or I need to explicitly call fstream.flush (), as indicated in the following example:

while not end of file
    read from source file
    bwriter.write()
    bwriter.flush()
    fstream.flush()
end while

Several people suggested that I explicitly call fstream.flush () to make sure the data was written to disk (or the device). However, my testing shows that the data is written to disk as soon as I call the flush () method of the bwriter object.

Can someone confirm this?

+3
source share
1 answer

Reflector, BinaryWriter.Flush Flush .

+4

Source: https://habr.com/ru/post/1748011/


All Articles