string path = @'D:\aaa';
if (Directory.Exists(path))
{
Console.WriteLine('文件夹');
}
else
{
if (File.Exists(path))
{
Console.WriteLine('文件');
}
else
{
Console.WriteLine('无效路径');
}
}
Console.Read();
原文地址:https://blog.csdn.net/qq_34573534/article/details/103257269
if (Directory.Exists(path))
{
Console.WriteLine('文件夹');
}
else
{
if (File.Exists(path))
{
Console.WriteLine('文件');
}
else
{
Console.WriteLine('无效路径');
}
}
Console.Read();
原文地址:https://blog.csdn.net/qq_34573534/article/details/103257269
