using System;
using System.IO;
namespace wu_ConsoleApplication6
{
class DirectoryTest
{
static void Main(string[] args)
{
Directory d=new Directory("F:\\c#");
Directory d1;
Directory d2;
try
{
d1=d.CreateSubdirectory("file1");
}
catch(IOException e)
{
Console.WriteLine("director file1 is failed ,because {0}",e);
return ;
}
try
{
d2=d.CreateSubdirectory("file1\\file2");
}
catch(IOException e)
{
Console.WriteLine("director file2 is failed ,because {0}",e);
return ;
}
Console.WriteLine("successed!!!");
}
}
}
我明明照书上抄写的,为什么还会有错呀。晕。
有三个错误,第一个错误在Directory d=new Directory("F:\\c#");
第二个错误在d1=d.CreateSubdirectory("file1");
第三个错误在d2=d.CreateSubdirectory("file1\\file2");