Disposes of the resources (other than memory) used by the FileSystemWatcher.
[Visual Basic] Overrides Public Sub Dispose() [C#] public override void Dispose(); [C++] public: override void Dispose(); [JScript] public override function Dispose();
Call Dispose when you are finished using the FileSystemWatcher. The Dispose method leaves the FileSystemWatcher in an unusable state. After calling Dispose, you must release all references to the FileSystemWatcher so the memory it was occupying can be reclaimed by garbage collection.
Note Always call Dispose before you release your last reference to the FileSystemWatcher. Otherwise, the resources the FileSystemWatcher is using will not be freed until garbage collection calls the FileSystemWatcher object's destructor.
FileSystemWatcher Class | FileSystemWatcher Members | System.IO Namespace