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.
METHOD | PURPOSE |
---|---|
AppendText | Appends Unicode text to a file. |
Copy | Copies a file to a new file. |
Create | Creates a file using the given path. |
CreateText | Creates or opens a file for writing. |
Delete | Deletes the given file. (No exception is thrown if the given file does not exist.) |
Exists | Determines whether the given ... |
Get Microsoft® Visual C#® .NET 2003 Kick Start 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.