Chapter 9: Files, Directories, and IO


Overview

The Microsoft .NET I/O classes fall into two basic categories. First are the classes that retrieve information from the file system and allow you to perform file system operations such as copying files and moving directories. Two examples include the FileInfo and the DirectoryInfo classes. Second, and possibly more important, are a broad range of classes that allow you to write and read data from all types of streams . Streams can correspond to binary or text files, a file in an isolated store, a network connection, or even a memory buffer. In all cases, the way you interact with a stream is the same. In this chapter, we'll look at the file system classes and a wide range of stream-based classes.

The recipes you'll find in this chapter cover the following topics.

  • How to retrieve or modify information about a file or a directory (recipes 9.1, 9.2, 9.4, 9.5, and 9.16).

  • How to copy, move, and delete files and directories (recipe 9.3).

  • How to display a directory tree dynamically in a Microsoft Windows “ based application (recipe 9.6) and use the common file dialog boxes (recipe 9.17).

  • How to read and write text (recipe 9.7) and binary (recipe 9.8) files, as well as how to create temporary files (recipe 9.15) and files in a user -specific isolated store (recipe 9.18).

  • How to read files asynchronously (recipe 9.9).

  • How to search for specific files (recipe 9.10) and test files for equality (recipe 9.11).

  • How to work with strings that contain path information (recipes 9.12 to 9.14).

  • How to monitor the file system for changes (recipe 9.19).

  • How to write to a COM port (recipe 9.20).




C# Programmer[ap]s Cookbook
C# Programmer[ap]s Cookbook
ISBN: 735619301
EAN: N/A
Year: 2006
Pages: 266

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net