By | March 28, 2012

Hi,

Use the following simple lines of code to check whether a particular file exists or not using C#/C Sharp.

using System;
using System.IO;

static class MainClass
{
    static void Main(string[] args)
    {
           Console.WriteLine(File.Exists("c:yourFile.txt"));
    }
}

It will return either True or False depending on whether your file exists or not.

🙂

Leave a Reply

Your email address will not be published. Required fields are marked *