Specifies how the operating system opens a file.
[
Edit]
[System.Runtime.InteropServices.ComVisible(true)] public enum FileMode |
|
Remarks
Members
Member Name | Description |
---|
Append | Requests a file be opened. If the file exists, its contents
are preserved. This value is valid only for FileAccess.Write
access. Attempts to read from a file opened with Append
cause an
exception.
[Edit]
|
Create | Requests a new file be created if it does not exist. The
file contents are overwritten if it does exist. This value is equivalent to
requesting that if the file does not exist, use FileMode.CreateNew;
otherwise, use FileMode.Truncate.
[Edit]
|
CreateNew | Requests a new file be created. An exception
is thrown if the file already exists.
[Edit]
|
Open | Requests an existing file be opened. An exception is
thrown if the file does not exist.
[Edit]
|
OpenOrCreate | Requests a file be opened. The file is
created if it does not exist.
[Edit]
|
Truncate | Requests an existing file be opened; existing contents
are deleted. This value is valid only for FileAccess.Write
access. Attempts to read from a file opened with Truncate
cause
an exception.
[Edit]
|
Requirements
Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0