所以,我看到了另一个问题的答案说,这应该工作:检查文件是否存在错误
using System.IO;
if (File.Exists(Path))
{
Action();
}
然而,当我这样做,我得到这些错误:
'System.IO' is a 'namespace', which is not valid in the given context
The Name 'File' does not exist in the current context
什么我做错了吗?
你也可能想看看ReSharper的,一个工具(不是免费的),有助于编写更干净的代码,并显示该类型的异常当你输入代码时是正确的。 – Mathieu 2012-04-09 02:36:06