C# check if file exists in directory code example
Example 1: c# check file exists
if (File.Exists(@"D:\myfile.txt")) {
Console.WriteLine("The file exists.");
}
Example 2: c# file exist
if (File.Exists("file.exe"))
{
//file exist
} else {
//does not exist
}