What’s in This Chapter
Wrox.com Downloads for This Chapter
Please note that all the code examples for this chapter are available as a part of this chapter’s code download on the book’s website at www.wrox.com/go/csharp5programmersref on the Download Code tab.
The preceding chapter described stream classes that you can use to read and write files. (It also described the
File class, which isn’t a stream class but is just too useful to ignore when you use streams.) Those classes are handy but even those like
StreamWriter that work at the highest levels still represent only the contents of files. They don’t give you any tools for working with the filesystem. Some of their methods can create a file, but they cannot rename or delete a file, or create or delete a directory.
This chapter describes classes that represent the filesystem. They allow you to create, rename, and delete files and directories. The final section in this chapter explains another important file-managing topic: how to use the recycle bin (wastebasket).
A program cannot perform a task unless the user has the appropriate permissions. Although this is true ...