FileSystemWatcher vs polling to watch for file cha

2018-12-31 08:10发布

I need to setup an application that watches for files being created in a directory, both locally or on a network drive.

Would the FileSystemWatcher or polling on a timer would be the best option. I have used both methods in the past, but not extensively.

What issues (performance, reliability etc.) are there with either method?

13条回答
呛了眼睛熬了心
2楼-- · 2018-12-31 09:13

I have run into trouble using FileSystemWatcher on network shares. If you're in a pure Windows environment, it might not be an issue, but I was watching an NFS share and since NFS is stateless, there was never a notification when the file I was watching changed.

查看更多
登录 后发表回答