我有这段代码返回true/false;我想返回true或false,如果给定的目录包含“.exe”
public static bool HasExecutable(string path)
{
var exts = "*.exe";
if (path.AsDirectory().Exists) return true;
if(path.AsDirectory().GetFiles(exts).Any(i => path.Contains(exts))) return true;
return false;
}
}
}
我放出来的是,停止我的程序的错误,我在这里缺少一些逻辑?
什么是错误信息? –
它是 未处理的异常:System.IO.DirectoryNotFoundException:找不到路径'c:\ program files(x86)\ notepad ++'的一部分。 。 –
@Aominè使用i元素时出现错误,无法从fileInfo转换。到字符串 –