监控使用FileSystemWatcher的多个文件夹 [英] Monitor multiple folders using FileSystemWatcher

查看:898
本文介绍了监控使用FileSystemWatcher的多个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么在C#中使用FileSystemWatcher的监视多个文件夹(非子目录)中的最佳方法是什么?

Whats the best way to monitor multiple folders (not subdirectories) using FileSystemWatcher in C#?

推荐答案

我不认为FSW支持监控多个文件夹,所以只是每个实例要监视的文件夹之一。您可以在相同的方法指向的事件处理程序,不过,这应该结束了工作像我想你想要的。

I don't think FSW supports monitoring multiple folders, so just instantiate one per folder you want to monitor. You can point the event handlers at the same methods, though, which should end up working like I think you want.

这篇关于监控使用FileSystemWatcher的多个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆