Languages
[Edit]
EN

C# / .NET - file exists

12 points
Created by:
AnnLen
9180

In C# / .NET it is possible to check does file exist in following way.

File.Exists method example

string path = @"C:\path\to\file.txt";

bool exists = File.Exists(path);
Console.WriteLine("File exists: " + (exists ? "Yes" : "No"));

Output:

File exists: No

References

  1. File.Exists Method - Microsoft Docs
Native Advertising
50 000 ad impressions - 449$
🚀
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂

Join