Multiple FileSystemWatcher question

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

I have created a Windows Service application which uses FileSystemWatcher to
monitor multiple folders and file filters.
These folders/files are loaded from a database table.
When a Change Event kicks off, how can I determine which of the
FileSystemWatcher instances it is for?

Terry
 
Terry,

The sender parameter on the event handler is the FileSystemWatcher
instance that fired the event. You can cast this to FileSystemWatcher, and
then make the determination which one fired the event, and act accordingly.

Hope this helps.
 
Back
Top