FileSystemWatcher not firing events

后端 未结 5 1557
感动是毒
感动是毒 2020-12-20 11:12

For some reason, my FileSystemWatcher is not firing any events whatsoever. I want to know any time a new file is created, deleted or renamed in my directory.

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-20 11:26

    My issue was that I expected it watches subdirectories also but it doesn't do it by default. If you would like to monitor also subdirectories then set IncludeSubdirectories property to true (it's false by default):

    fileSystemWatcher.IncludeSubdirectories = true;
    

提交回复
热议问题