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 *

 

 

 

Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.