In .Net how can I monitor if a file has been accessed (opened) by other programs? I can't see OnOpe开发者_如何学运维ned event in FileSystemWatcher, so I assume it can not do that. Is there any other way to do it? It's clearly possible in Windows, is there some sort of hook available from .Net?
Check out the NotifyFilters property. You probably want to look for changes in access date/time.
NotifyFilters enumeration has interesting you value: LastAccess indicating last file or directory access. This has to be set to the NotifyFilter property.
精彩评论