The File Class
FileInfo class, the
System.IO namespace provides a home for a static class called
File. Whereas one usually uses a
FileInfo to pass around information about a file as an object, the
File class provides a series of static methods that expose file system functionality. In fact, some of
FileInfo’s instance methods simply call into some of the static methods provided on file.
A first set of methods that deal with files on a wholesale basis is omitted from our discussion here because we’ve seen similar methods like
FileInfo. Instead, we focus on methods that provide access to the contents of a file, which brings us to the concept of readers and writers quite directly.
Note: Directory Versus DirectoryInfo