4.2. Working with the file system

The System.IO namespace contains several classes used to work with the file system. The FileSystemInfo class serves as a base class for the FileInfo and DirectoryInfo classes. There is also a File class that allows us to work with files and a Directory class for directory manipulations. Figure 4.7 shows these classes.

Figure 4.7. The File and Directory classes

Note the difference between the classes mentioned above. The FileInfo class provides instance methods for the creation, copying, deletion, moving, and opening of files – it aids in the creation of FileStream objects. The File class provides static methods ...

Get A Programmer's Guide to .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.