programming-examples/c-sharp/Files/C# Program to Check the Existence of a File.cs
2019-11-15 12:59:38 +01:00

25 lines
503 B
C#

/*
* C# Program to Check the Existence of a File
*/
using System;
using System.IO;
class Program
{
static void Main()
{
FileInfo info = new FileInfo("C:\\sri\\srip.txt");
bool exists = info.Exists;
if (exists == true)
{
Console.WriteLine("The File Exists");
}
else
{
Console.WriteLine("No Such File Found");
}
Console.Read();
}
}
/*
File Exists