我使用的是 Visual c# 2010 速成版,我经常处理文件,有 writexml 和用于 txt 写入的文件流。
问题是,当我按 F5 并试用程序时,它会正确写入文件,但是当我关闭时,文件会被删除吗?
如果我这样写一个文件:
Table.WriteXml("tablexml.xml", XmlWriteMode.WriteSchema);
文件存储在哪里? 如果我关闭以 Debug模式 (F5) 运行的程序,文件会保留在那里供阅读吗?
请您参考如下方法:
The question is, when i press f5 and try out the program it writes the files correctly, but when i close, do the files get deleted?
没有。这些文件只有在您删除它们时才会被删除。
where does the file get stored? will the file remain there for reading if i close the program that was running in debugmode (F5) ?
大多数情况下,当您不指定路径时,文件将写入进程认为是其工作目录的位置。您可以设置工作目录:
System.IO.Directory.SetCurrentDirectory(path);
可以在项目设置中设置项目的工作目录。
