C#: Using FileSystemWatcher to watch for changes to files

后端 未结 3 1557
醉梦人生
醉梦人生 2021-01-22 15:42

Ok, so I learnt from How to check if a open file has been updated that I should use a FileSystemWatcher to watch for changes to files. Then now, the question is if I must keep

3条回答
  •  旧巷少年郎
    2021-01-22 16:10

    I think you're definitely on the right track. It's up to you how to store the multiple fileWatchers but disposing of them and clearing their queue as quickly as possible are important for reliability. You only need one per directory, not file.

    There are lots of posts about the unreliability of fileWatchers so be diligent in your usage.

提交回复
热议问题