Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
某个文本文件不断被另一个进程占用以更新其内容,我需要我的应用程序偶尔清除其内容。我在想 FileStream 的 fileshare.ReadWrite 属性可能有用,但我不能 100% 确定。
如何清除另一个进程拥有的文本文件?
为什么不直接用空字符串覆盖 txt 文件呢?
System.IO.File.WriteAllText("filepath to the txt doc", emptystring make sure to initialize);