In C #, we often need to operate on files. Of course, there are many file types. Here I will focus on the class used for input and output.
1. Stream: All Input and Output tasks in. NET Framework must use a stream. Stream is an abstract representation of serialized devices.
2. system. Io namespace
File: provides many static methods for moving, copying, and deleting files.
Directory: provides many static methods for moving, copying, and deleting directories.
Fileinfo: indicates a physical file on the disk. It can process this file. to read and write the file, you must create a stream object.
Directoryinfo: indicates the physical directory on the disk, which can be processed.
Filestream: indicates a file that can be written, read, or both. This file can be read and written synchronously or asynchronously.
Streamreader: reads character data from a stream and can be created as the base class by using filestream.
Streamwriter: Write character data to a stream. You can use filestream to create a base class.
Filesystemwatcher: used to monitor files and directories and give applications when these locations changeProgramEvents that can be captured.