System.IO.FileSystemWatcher Class
Monitors File System's changes in directories, files and files inside directories.

See Also: FileSystemWatcher Members


public class FileSystemWatcher : System.ComponentModel.Component, System.ComponentModel.ISupportInitialize


Mono's implementation of the FileSystemWatcher has multiple backends. This is necessary because not all operating systems supported by Mono have all the features necessary to provide the functionality expected by applications.

If the operating system kernel supports watching directories (inotify on Linux, KEvents on BSD or OSX) that feature is used; Otherwise it falls back to using the Gamin or FAM libraries (these libraries provide an API to monitor directories) and if none of those features are available, Mono will poll every 750 milliseconds the directories watched.

You can force the polling behavior (instead of using the kernel support) by setting the MONO_MANAGED_WATCHER environment variable before executing your application. This might be useful for filesystems that do not support inotify and still require polling to detect changes.


Namespace: System.IO
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0,,