FileSystemWatcher vs polling to watch for file changes

后端 未结 13 2323
一个人的身影
一个人的身影 2020-11-22 05:44

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 p

13条回答
  •  再見小時候
    2020-11-22 06:08

    I currently use the FileSystemWatcher on an XML file being updated on average every 100 milliseconds.

    I have found that as long as the FileSystemWatcher is properly configured you should never have problems with local files.

    I have no experience on remote file watching and non-Windows shares.

    I would consider polling the file to be redundant and not worth the overhead unless you inherently distrust the FileSystemWatcher or have directly experienced the limitations everyone else here has listed (non-Windows shares, and remote file watching).

提交回复
热议问题