Using the C# system.io Namespace
File I/O
Interacting with files and directories is one of those areas of programming that can be both subtle and potentially difficult. Some of the important issues: simply using the API, performance, and exception handling. In the case of C#, this language provides some powerful mechanisms. Even in these days of ubiquitous databases, there's still a huge amount of data stored in disk files. In fact, IBM reckons that about 15 petabytes of data is created every daymore than the entire contents of all the libraries in the U.S. Being able to create, modify, and delete disk data is an important skill today, and is likely to remain so in the future.
On a deeper level, any form of persistent storage (including databases) is a mechanism by which data can outlive the process or application that created it. In this context, C# I/O code provides an on-demand gateway to your disk data. As you'll see in this article, there are many subtleties to effective I/O programming.
Now let's get started with an example of directory creation.