O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The File Class

Alongside the 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 Delete on 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

As ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required