string path = @"D:\aaa";
if (Directory.Exists(path))
{
Console.WriteLine("文件夹");
}
else
{
if (File.Exists(path))
{
Console.WriteLine("文件");
}
else
{
Console.WriteLine("无效路径");
}
}
Console.Read();
string path = @"D:\aaa";
if (Directory.Exists(path))
{
Console.WriteLine("文件夹");
}
else
{
if (File.Exists(path))
{
Console.WriteLine("文件");
}
else
{
Console.WriteLine("无效路径");
}
}
Console.Read();