如何找出一个文件存在于C#/。NET? [英] How to find out if a file exists in C# / .NET?
本文介绍了如何找出一个文件存在于C#/。NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想测试包含文件路径是否存在该文件(有点像 -e
测试在Perl或 os.path.exists()
在Python)在C#。
I would like to test a string containing a path to a file for existence of that file (something like the -e
test in Perl or the os.path.exists()
in Python) in C#.
推荐答案
使用:
File.Exists(path)
MSDN:<一href="http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx">http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx
编辑:System.IO
In System.IO
这篇关于如何找出一个文件存在于C#/。NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文