check if a file exists - CSharp File IO

CSharp examples for File IO:File Command

Description

check if a file exists

Demo Code

using static System.Console;
using static System.IO.Directory;
using static System.IO.Path;
using static System.Environment;
using System.IO;//from   w  w w  . ja  va2  s .  com
class Program
{
   static void Main(string[] args)
   {
      WriteLine($"Does it exist? {File.Exists("z.txt")}");
   }
}

Result


Related Tutorials