Можно ли делать проверку через new DirectoryInfo(Path).Exists ? - C#
Формулировка задачи:
Метод для проверки:
Можно ли использовать данный метод?
или же обычным ?
public static DirectoryInfo DirEx(string Path)
{
return new DirectoryInfo(Path);
}
public static readonly string des = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\Folder";
bool FolderDesk = DirEx(des).Exists;
if (!FolderDesk)
{
Console.WriteLine("Папка не существует");
}
else
Console.WriteLine("Папка существует");Directory.Exists(path);
Решение задачи: «Можно ли делать проверку через new DirectoryInfo(Path).Exists ?»
textual
Листинг программы
bool FolderDesk = Directory.Exists(des);
if (!FolderDesk)
{
Console.WriteLine("Как-то так?");
}