轮询方法FileSystemWatcher

具体实现
FileSystemWatcher watcher = new FileSystemWatcher(WriteBackDir, "*result.txt");
watcher.Created += watcher_Created;
watcher.EnableRaisingEvents = true;

生成一个watcher_Created方法

void watcher_Created(object sender, FileSystemEventArgs e)
{
//里面对具体的文件进行操作,多个文件也会执行多次,FileSystemEventArgs包含处理文件的具体信息
CreateResult(e.FullPath);
}

posted @ 2015-07-20 10:46  .Net之旅  阅读(599)  评论(0编辑  收藏  举报