CSharpTest.Net
BackgroundWriter Constructor(Stream)
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.IO Namespace > BackgroundWriter Class > BackgroundWriter Constructor : BackgroundWriter Constructor(Stream)

stream

Glossary Item Box

Create the writer and thread

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal stream As Stream _
)
C# 
public BackgroundWriter( 
   Stream stream
)

Parameters

stream

Example

Library/Library.Test/TestBackgroundWriter.cs

C#Copy Code
using (ManualResetEvent mre = new ManualResetEvent(false))
using (TestStream io = new TestStream())
using (BackgroundWriter wtr = new BackgroundWriter(io))
{
    wtr.Perform(s => s.Write(new byte[100], 0, 100), mre);
    Assert.IsTrue(mre.WaitOne(60000, false));
    Assert.AreEqual(100, io.Position);
    Assert.AreEqual(100, io.Length);
}
VB.NETCopy Code
Using mre As New ManualResetEvent(False)
    Using io As New TestStream()
        Using wtr As New BackgroundWriter(io)
            wtr.Perform(Function(s) s.Write(New Byte(100) {}, 0, 100), mre)
            Assert.IsTrue(mre.WaitOne(60000, False))
            Assert.AreEqual(100, io.Position)
            Assert.AreEqual(100, io.Length)
        End Using
    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