public enum FileMode
Object
ValueType
Enum
FileMode
mscorlib
BCL
Specifies how the operating system opens a file.
FileMode values specify whether a file is created if one does not exist, and determine whether the contents of existing files are retained or overwritten.
System.IO Namespace
FileMode Fields
FileMode.Append Field
FileMode.Create Field
FileMode.CreateNew Field
FileMode.Open Field
FileMode.OpenOrCreate Field
FileMode.Truncate Field
FileMode.value__ Field
Append = 6;
Requests a file be opened. If the file exists, its contents are preserved. This value is valid only for System.IO.FileAccess.Write access. Attempts to read from a file opened withAppend
cause an exception.
System.IO.FileMode Enum, System.IO Namespace
Create = 2;
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 System.IO.FileMode.CreateNew; otherwise, use System.IO.FileMode.Truncate.
System.IO.FileMode Enum, System.IO Namespace
CreateNew = 1;
Requests a new file be created. An exception is thrown if the file already exists.
System.IO.FileMode Enum, System.IO Namespace
Open = 3;
Requests an existing file be opened. An exception is thrown if the file does not exist.
System.IO.FileMode Enum, System.IO Namespace
OpenOrCreate = 4;
Requests a file be opened. The file is created if it does not exist.
System.IO.FileMode Enum, System.IO Namespace
Truncate = 5;
Requests an existing file be opened; existing contents are deleted. This value is valid only for System.IO.FileAccess.Write access. Attempts to read from a file opened withTruncate
cause an exception.
System.IO.FileMode Enum, System.IO Namespace
value__;
System.IO.FileMode Enum, System.IO Namespace