Working with Directories

This chapter covers file handling, so we'll start with the File and Directory classes, which enable you to work on files without opening them (you can copy a file to another directory, for example). After using the File and Directory classes to manipulate files and directories, we'll turn to the use of streams to handle the contents of files and other data streams directly.

There's a lot of support for working directly with directories in C#. For example, you can use the static members of the Environment class to get the current directory, the system directory, and so on. Here are some of the more useful members of the Environment class:

  • System.Environment.CurrentDirectory— Returns or sets the (fully qualified) path ...

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.