Main content:
The related operation of the path, such as determining whether the path is legitimate, the path type, the specific part of the path, the merged path, the system folder path and so on;
The related Common file dialog box, these dialog boxes can help us to operate the file system files and directories;
Third, file and directory operations, such as copy, move, delete, rename, file version information, document, etc., search, read and write files, etc.
Read and write files, monitor the file system;
V. Other, such as temporary files, random file names, etc.;
First-Path related operations and use of common file dialog boxes
Second-file and directory related operations
This article will introduce the fourth to fifth part.
File read and write related class introduction:
The main classes involved in file read and write operations are:
MarshalByRefObject class: Allows access to objects across application domain boundaries in applications that support remoting;
BinaryReader class: Reads a primitive data type as a binary value with a specific encoding.
BinaryWriter class: Writes a primitive type to a stream in binary form and supports writing a string with a specific encoding.
Stream class: Provides a general view of a sequence of bytes.
FileStream class: Exposes a file-oriented Stream that supports both synchronous read-write operations and asynchronous read-write operations.
MemoryStream class: Creates a stream whose support store is memory.
BufferedStream class: Adds a buffer layer to another class of read and write operations.
TextReader class: A reader that represents a series of contiguous characters.
TextWriter class: Represents a writer that can write an ordered series of characters.
StreamReader class: Implements a TextReader that reads characters from a byte stream in a specific encoding.
StreamWriter class: Implements a TextWriter that writes characters to the stream in a specific encoding.
StringReader class: Implements a TextReader that reads from a string.
StringWriter class: Implements a TextWriter that is used to write information to a string. This information is stored in the underlying StringBuilder.
It is best to understand their inheritance before using them, and to help make the most appropriate choice:
Also pay attention to some FileInfo and file class methods, such as Create,createtext,open, sometimes also bring convenience.
These classes have a wide range of content, and please refer to MSDN for more information.
Here are some common problems and their solutions: