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# 服务)(在网络存储上,比如 NAS)。我想确保在执行写操作时,我应该能够获得文件的锁,写入然后解锁它。
写入文件时如何锁定网络上的文件?
看一眼
FileStream.Lock 方法和FileStream.Unlock 方法