Working with files and directories
The System.IO
namespace contains two classes for working with directories (Directory
and DirectoryInfo
), and two for working with files (File
and FileInfo
). Directory
and File
are static classes but contain mostly the same functionality provided by the instance classes—DirectoryInfo
and FileInfo
.
The latter two are derived from the FileSystemInfo
base abstract class, which provides members that are common for manipulating both files and directories. The most important of these members are the properties listed in the following table:
The most important members of the DirectoryInfo
class, excluding the ones inherited from the base class, which were listed in the preceding table, are as follows:
Similarly, the most important members of the FileInfo
class, excluding the ones inherited from the base class, are as follows:
Now that we have...