文件说:File.WriteAllText是否真的会引发FileNotFoundException?
// Summary:
// Creates a new file, writes the specified string to the file, and then closes
// the file. If the target file already exists, it is overwritten.
第一行,第一句:Creates a new file
,并在例外它列出:
// System.IO.FileNotFoundException:
// The file specified in path was not found.
在这种情况下,会出现这种情况?如果它总是创建一个文件,那么它不应该抛出FileNotFoundException ...
文档是否错误?或者它可能丢失了<remarks>
标签?
如果找不到路径的一部分,该怎么办?那会是'FileNotFoundException'或'DirectoryNotFound'吗? – 2012-02-18 04:23:25
@JohnSaunders是一个'DirectoryNotFoundException':'{“找不到路径'C:\\ ZZZZZZ \\ ZZZ \\ TEST.txt'的一部分。”}' – BrunoLM 2012-02-18 04:25:25
这是一个复制粘贴File.ReadAllText()文章。 – 2012-02-18 09:19:09