初级程序员以及以上的就别来这里看 了 ,菜鸟我怕浪费你宝贵的时间!
string path = @"E:\C #";
if(Directory.Exists(path))
{
string[] dis = Directory.GetDirectories(path);
Console.WriteLine("子目录 ");
foreach(string item in dis)
{
Console.WriteLine(item);
}
string[] files = Directory.GetFiles(path);
Console.WriteLine("文件");
foreach(string file in files)
{
Console.WriteLine(file);
}
}
Console.WriteLine("目录不存在! ");
作为菜鸟 这里是提示自己