Working with Files

There's a parallel set of classes to Directory and DirectoryInfo that enables you to work with files—File and FileInfo. The File class works with files in general, and the FileInfo class works with a specific file. Like Directory, File is a static class, and you can see the significant public methods of this class in Table 5.4, which let you create files, delete them, move them, and more.

Table 5.4. Significant Static Public File Methods
AppendTextAppends Unicode text to a file.
CopyCopies a file to a new file.
CreateCreates a file using the given path.
CreateTextCreates or opens a file for writing.
DeleteDeletes the given file. (No exception is thrown if the given file does not exist.)
ExistsDetermines whether the given ...

Get Microsoft® Visual C#® .NET 2003 Kick Start now with the O’Reilly learning platform.

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