CSharpTest.Net
Flush Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.IO Namespace > BackgroundWriter Class : Flush Method

Glossary Item Box

Waits for all pending writes and flushes the stream prior to returning

Syntax

Visual Basic (Declaration) 
Public Sub Flush() 
C# 
public void Flush()

Example

Library/Library.Test/TestBackgroundWriter.cs

C#Copy Code
using (TestStream io = new TestStream())
using (BackgroundWriter wtr = new BackgroundWriter(io))
{
    wtr.Perform(s => s.Write(new byte[100], 0, 100));
    wtr.Flush();
    Assert.AreEqual(100, io.Position);
    Assert.AreEqual(100, io.Length);
}
VB.NETCopy Code
Using io As New TestStream()
    Using wtr As New BackgroundWriter(io)
        wtr.Perform(Function(s) s.Write(New Byte(100) {}, 0, 100))
        wtr.Flush()
        Assert.AreEqual(100, io.Position)
        Assert.AreEqual(100, io.Length)
    End Using
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys