File.Open Method (String, FileMode)
Opens a FileStream on the specified path with read/write access.
Assembly: mscorlib (in mscorlib.dll)
The file to open.
path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
path is null.
The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
The specified path is invalid, (for example, it is on an unmapped drive).
An I/O error occurred while opening the file.
path specified a file that is read-only.
This operation is not supported on the current platform.
path specified a directory.
The caller does not have the required permission.
mode is Create and the specified file is a hidden file.
mode specified an invalid value.
The file specified in path was not found.
path is in an invalid format.
The following code example creates a temporary file and writes some text to it. The example then opens the file, using T:System.IO.FileMode.Open; that is, if the file did not already exist, it would not be created.
Available since 10
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.0