Multiple FileSystemWatcher question

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top