How to find out if a file exists in C# / .NET?
Solution 1:
Use:
File.Exists(path)
MSDN: http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx
Edit: In System.IO
Solution 2:
System.IO.File:
using System.IO;
if (File.Exists(path))
{
Console.WriteLine("file exists");
}
Solution 3:
System.IO.File.Exists(path)
msdn
Solution 4:
Give full path as input. Avoid relative paths.
return File.Exists(FinalPath);