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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.