check if a directory exists - CSharp File IO

CSharp examples for File IO:Directory

Description

check if a directory exists

Demo Code

using static System.Console;
using static System.IO.Directory;
using static System.IO.Path;
using static System.Environment;
class Program/*from www  .  j a v a 2  s .co m*/
{
   static void Main(string[] args)
   {
      string dir = "aDir";
      WriteLine($"Does it exist? {Exists(dir)}");
   }
}

Result


Related Tutorials