Method FileWatcher.Watch
Overload
Starts watching a file for external changes. An external change is when another process writes, creates, deletes, moves or renames the file.
public static FileWatcher Watch(string file, Action onExternalChange)
Parameters
file (string)
Full path of a file, without environment variables. |
onExternalChange (Action)
Called when detected that the file was changed externally.
Important: when your app writes, creates, deletes, moves or renames the file, it must set FileWatcher.Paused = |
Returns
FileWatcher
A new FileWatcher instance used to manage the watcher.
Don't need to dispose it, unless you want to stop watching before the process exits.
Returns |
Exceptions
NotSupportedException
Thrown if this method has already been called for the same file without a corresponding call to FileWatcher.Dispose. If multiple notification handlers are needed, combine them into the onExternalChange delegate. |