Я хотел бы проверить строку, содержащую путь к файлу, на наличие этого файла (что-то вроде теста -e в Perl или os.path.exists() в Python) в C #.
-e
os.path.exists()
Использование:
File.Exists(path)
MSDN: http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx
Редактировать: в System.IO
System.IO.File
using System.IO; if (File.Exists(path)) { Console.WriteLine("file exists"); }
System.IO.File.Exists (путь)
* 1004 MSDN *
Введите полный путь в качестве ввода. Избегайте относительных путей.
return File.Exists(FinalPath);