我希望这项工作在不同的线程中完成,但我必须创建一个线程还是它在不同的线程上完成所有工作?
喜欢:
Thread fileThread = new Thread(() =>
{
FileWatcher = new FileSystemWatcher();
FileWatcher.Created += OnFileEvent;
FileWatcher.Deleted += OnFileEvent;
FileWatcher.Renamed += OnRenameEvent;
FileWatcher.EnableRaisingEvents = true;
});
fileThread.Start();