File Class |
Namespace: System.IO
public static class File
The File type exposes the following members.
Name | Description | |
---|---|---|
AppendText | Creates a StreamWriter that appends UTF-8 encoded text to an existing file. | |
Copy(String, String) | Copies an existing file to a new file. Overwriting a file of the same name is not allowed. | |
Copy(String, String, Boolean) | Copies an existing file to a new file. Overwriting a file of the same name is allowed. | |
Create(String) | Creates or overwrites a file in the specified path. | |
Create(String, Int32) | Creates or overwrites the specified file. | |
Create(String, Int32, FileOptions) | Creates or overwrites the specified file, specifying a buffer size and a FileOptions value that describes how to create or overwrite the file. | |
Create(String, Int32, FileOptions, FileSecurity) | Creates or overwrites the specified file with the specified buffer size, file options, and file security. | |
CreateText | Creates or opens a file for writing UTF-8 encoded text. | |
Delete | Deletes the specified file. | |
Exists | Determines whether the specified file exists. | |
Open(String, FileMode) | Opens a FileStream on the specified path with read/write access. | |
Open(String, FileMode, FileAccess) | Opens a FileStream on the specified path, with the specified mode and access. | |
Open(String, FileMode, FileAccess, FileShare) | Opens a FileStream on the specified path, having the specified mode with read, write, or read/write access and the specified sharing option. | |
OpenRead | Opens an existing file for reading. | |
OpenWrite | Opens an existing file or creates a new file for writing. | |
ReadAllBytes | Opens a binary file, reads the contents of the file into a byte array, and then closes the file. | |
ReadAllText(String) | Opens a text file, reads all lines of the file, and then closes the file. | |
ReadAllText(String, Encoding) | Opens a file, reads all lines of the file with the specified encoding, and then closes the file. |