EN
C# / .NET - file exists
12 points
In C# / .NET it is possible to check does file exist in following way.
xxxxxxxxxx
1
string path = @"C:\path\to\file.txt";
2
3
bool exists = File.Exists(path);
4
Console.WriteLine("File exists: " + (exists ? "Yes" : "No"));
Output:
xxxxxxxxxx
1
File exists: No