How To Use C# Directory Class
How To Use C# Directory Class
Directory class in exposes methods to create , delete , move etc. operations to directories and
subdirectories . Because of the static nature of C# Directory class , we do not have to instantiate the class. We
can call the methods in the C# Directory class directly from the Directory class itself.
In order to create a new directory using Directory class in C# , we can call CreateDirectory method directly from
Directory class.
Before we creating a directory or folder , we usually check that directory or folder exist or not. In C# we are using
Exists method in the Directory class.
If we want to move a directory and its contents from one location to another , we can use the Move method in
the C# Directory class.
When we want to delete a directory we can use the Delete method in the C# Directory class
1 of 2 11/1/2016 12:44 AM
PrintFriendly.com: Print web pages, create PDFs http://www.printfriendly.com/print?url_s=uGGC%dN%cS%cSpFun...
using System;
using System.Windows.Forms;
using System.IO;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
2 of 2 11/1/2016 12:44 AM