Share via


FileStream Constructor (String, FileMode, FileAccess, FileShare, Int32)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Initializes a new instance of the FileStream class with the specified path, creation mode, read/write and sharing permission, and buffer size.

Namespace:  System.IO
Assembly:  System.IO (in System.IO.dll)

Syntax

'Declaration
Public Sub New ( _
    path As String, _
    mode As FileMode, _
    access As FileAccess, _
    share As FileShare, _
    bufferSize As Integer _
)
public FileStream(
    string path,
    FileMode mode,
    FileAccess access,
    FileShare share,
    int bufferSize
)
public:
FileStream(
    String^ path, 
    FileMode mode, 
    FileAccess access, 
    FileShare share, 
    int bufferSize
)
new : 
        path:string * 
        mode:FileMode * 
        access:FileAccess * 
        share:FileShare * 
        bufferSize:int -> FileStream
public function FileStream(
    path : String, 
    mode : FileMode, 
    access : FileAccess, 
    share : FileShare, 
    bufferSize : int
)

Parameters

  • path
    Type: System. . :: . .String
    A relative or absolute path for the file that the current FileStream object will encapsulate.
  • bufferSize
    Type: System. . :: . .Int32
    A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes.

Remarks

CanSeek is true for all FileStream objects that encapsulate files. If path indicates a device that does not support seeking, the CanSeek property on the resulting FileStream is false. For additional information, see CanSeek.

Warning

When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.

.NET Framework Security

See Also

Reference

FileStream Class

FileStream Overload

System.IO Namespace