Click or drag to resize
FileInfoOpen Method (FileMode)
Opens a file in the specified mode.

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public FileStream Open(
	FileMode mode
)

Parameters

mode
Type: System.IOFileMode
A FileMode constant specifying the mode (for example, Open or Append) in which to open the file.

Return Value

Type: FileStream
A file opened in the specified mode, with read/write access and unshared.
Exceptions
ExceptionCondition
FileNotFoundExceptionThe file is not found.
UnauthorizedAccessExceptionThe file is read-only or is a directory.
DirectoryNotFoundExceptionThe specified path is invalid, such as being on an unmapped drive.
IOExceptionThe file is already open.
See Also