Does FileSystemWatcher create its own thread?

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();

Answers


You don't have to create a thread. The events will be called on a separate thread automatically.


Need Your Help

How to clear a session container in Zend framework2

php zend-framework2 zend-session

I have recently started building an application using Zendframework 2 , I have good experience in ZF1 , the major problem I am facing here with ZF2 is with sessions .

What is the best way to stop a user from resizing the top-level window of an application written in WPF?

wpf resize size

What is the best way to stop a user from resizing the top-level window of an application written in WPF?