Delete a Directory in CSharp
Description
The following code shows how to delete a Directory.
Example
/* ww w. j a va 2 s . c o m*/
using System;
using System.IO;
class MaionClass
{
public static void Main(String[] args)
{
try
{
Directory.Delete(@"C:\MyFoo");
Directory.Delete(@"C:\MyBar", true);
}
catch(IOException e)
{
Console.WriteLine(e.Message);
}
}
}
The code above generates the following result.