syn*_*cis 15 .net c# multithreading filesystemwatcher
我希望这项工作在不同的线程中完成,但我是否必须创建一个线程或者它是否在不同的线程上完成所有工作?
喜欢:
Thread fileThread = new Thread(() =>
{
FileWatcher = new FileSystemWatcher();
FileWatcher.Created += OnFileEvent;
FileWatcher.Deleted += OnFileEvent;
FileWatcher.Renamed += OnRenameEvent;
FileWatcher.EnableRaisingEvents = true;
});
fileThread.Start();
Run Code Online (Sandbox Code Playgroud)