I want this work to be done in a different thread but do i have to create a thread or does it do all the work on different threads?
Like:
Thread fileThread = new Thread(() =>
{
FileWatcher = new FileSystemWatcher();
FileWatcher.Created += OnFileEvent;
FileWatcher.Deleted += OnFileEvent;
FileWatcher.Renamed += OnRenameEvent;
FileWatcher.EnableRaisingEvents = true;
});
fileThread.Start();
You don't have to create a thread. The events will be called on a separate thread automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With