本文介绍了如何找出文件是否存在于 C#/.NET 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试一个包含文件路径的字符串是否存在该文件(类似于 Perl 中的 -e 测试或 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:http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx

在 System.IO

In System.IO

这篇关于如何找出文件是否存在于 C#/.NET 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 09:43
查看更多