Why are FileSystemWatcher Attribute changes detected on Windows 7 but not Windows 8?

后端 未结 5 1098
太阳男子
太阳男子 2020-12-14 06:31

I have some code that uses FileSystemWatcher to monitor file changes outside of my application.

On Windows 7, using .NET 4, the below code would detect when a file

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-14 06:51

    FileSystemWatcher is notoriously unreliable. Try subscribing to all the events and see if the others fire. One thing that you could try is to use a timer to examine the file for changes at regular intervals, say once every two seconds, instead of using FileSystemWatcher.

提交回复
热议问题