You create an instance of the FileSystemWatcher component when you want to build file system monitoring into your application. FileSystemWatcher components allow you to connect to directories and watch for specific changes within them, such as the creation of new files, addition of subdirectories, and renaming of files or subdirectories.
To create an instance of the FileSystemWatcher component programmatically
[Visual Basic] Dim myWatcher as New FileSystemWatcher [C#] FileSystemWatcher myWatcher = new FileSystemWatcher ();
Configuring FileSystemWatcher Component Instances | Introduction to File System Components