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.
如何写入 C# 中另一个进程使用的文件?
我可以使用 读取文件FileShare.ReadWrite,但它仅适用于FileAccess.Read. 有没有人有办法解决吗?
FileShare.ReadWrite
FileAccess.Read
如果另一个进程已经写锁定了文件,那么你无能为力,除非你不介意关闭另一个进程的句柄或杀死它。
您应该将文件内容读取到单独的 Stream 中,然后释放文件。