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# 函数可以帮助我?
提前致谢。
您只需将适当的参数传递给该File.Open()方法:
File.Open()
using (var stream = File.Open("path", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { // You can read, they (logger) can write }
FileShare 标志允许打开已打开的文件。