CSharpTest.Net
FileStreamFactory Constructor(String,FileMode,FileAccess,FileShare,Int32,FileOptions)
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.IO Namespace > FileStreamFactory Class > FileStreamFactory Constructor : FileStreamFactory Constructor(String,FileMode,FileAccess,FileShare,Int32,FileOptions)

filename
mode
access
share
bufferSize
options

Glossary Item Box

Creates an IFactory for creating streams on a single file

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal filename As String, _
   ByVal mode As FileMode, _
   ByVal access As FileAccess, _
   ByVal share As FileShare, _
   ByVal bufferSize As Integer, _
   ByVal options As FileOptions _
)
C# 
public FileStreamFactory( 
   string filename,
   FileMode mode,
   FileAccess access,
   FileShare share,
   int bufferSize,
   FileOptions options
)

Parameters

filename
mode
access
share
bufferSize
options

Example

Library/Library.Test/TestStreamCache.cs

C#Copy Code
using(TempFile tempFile = new TempFile())
{
    FileStreamFactory factory = new FileStreamFactory(tempFile.TempPath, FileMode.Create, FileAccess.ReadWrite, FileShare.None, 1024, FileOptions.Asynchronous);
    Assert.AreEqual(tempFile.TempPath, factory.FileName);
    using (FileStream s = (FileStream)factory.Create())
        Assert.IsTrue(s.CanRead && s.CanWrite && s.IsAsync);
}
VB.NETCopy Code
Using tempFile As New TempFile()
    Dim factory As New FileStreamFactory(tempFile.TempPath, FileMode.Create, FileAccess.ReadWrite, FileShare.None, 1024, FileOptions.Asynchronous)
    Assert.AreEqual(tempFile.TempPath, factory.FileName)
    Using s As FileStream = DirectCast(factory.Create(), FileStream)
        Assert.IsTrue(s.CanRead AndAlso s.CanWrite AndAlso s.IsAsync)
    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