System.IO

To demonstrate some of the classes available in the System.IO namespace, a Directory application was built in the Directory directory. By recursing through the directory structure, you can make use of the Directory, File, FileInfo, and DirectoryInfo classes. (This sample application is available in the Directory directory.) Listing B.55 shows a code snippet that initializes a tree control with drive and directory information.

Listing B.55. Filling the TreeControl with File, Directory, and Drive Information
private void InitializeTreeControl()
{
// Initialize TreeControl.
// Populate the TreeView with data.
// First add the root node.
rootNode = new TreeNode("My Computer", (int)ImageListTypes.Computer, (int)ImageListTypes
.Computer); ...

Get .NET Common Language Runtime Unleashed 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.