Working with Directories and Files in .NET
page 1 of 6
Published: 20 Jul 2007
In any programming language we are required to read and write to files. This article discusses how we can use C# to read and write files with the help of code snippets.
by Joydip Kanjilal
Average Rating: 
Views (Total / Last 10 Days): 26754/ 26


Microsoft .NET allows you to read and write files in your file system provided you have set the necessary permissions. One of the most powerful things that Microsoft .NET provides you is its rich Base Class Library that gives you enormous flexibility to do anything that you can think of. The Base Class Library of the Microsoft .NET Framework class is actually a library of classes, interfaces that are included as a part of the in the Microsoft .NET Framework Software Developer's Kit (SDK). A directory is a special type of file that can contain other files and/or directories. Hence, we will start our discussion with how we can work with directories in C# followed by a discussion on how we can use C# to read and write files to and from the file system.

The Directory, DirectoryInfo, File and FileInfo classes in the .NET Base Class Library provide a simplified and powerful access to the files and directories in your system.

The names of the members of the Directory, DirectoryInfo, File and the FileInfo classes are self explanatory. I have shaved off the unnecessary discussion on the members of these classes that have names that correspond to their respective purposes. I hoped that the readers would be able to understand them with ease; still, you can always refer to MSD for more information.

The following sections discuss each of the above classes and its members and how they can be used to work with files and directories from within Microsoft .NET’s managed environment.

View Entire Article

User Comments

No comments posted yet.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-06-20 9:25:18 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search