FileInfoOpen Method (FileMode) |
Opens a file in the specified mode.
Namespace: System.IOAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax 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:
FileStreamA file opened in the specified mode, with read/write access and unshared.
Exceptions Exception | Condition |
---|
FileNotFoundException | The file is not found. |
UnauthorizedAccessException | The file is read-only or is a directory. |
DirectoryNotFoundException | The specified path is invalid, such as being on an unmapped drive. |
IOException | The file is already open. |
See Also