在提供的示例中,我到处都能找到这两行代码,它们用于为文件系统监视程序设置过滤器..
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Filter = "*.txt";
//or
watcher.Filter = "*.*";
但我希望我的观察者监视更多的文件类型,但不是全部.我怎样才能做到这一点:
//watcher.Filter = "*.txt" | "*.doc" | "*.docx" | "*.xls" | "*.xlsx";
我试过这些:
watcher.Filter = "*.txt|*.doc|*.docx|*.xls|*.xlsx";
// and
watcher.Filter = "*.txt;*.doc;*.docx;*.xls;*.xlsx*";
两种方法都不起作用.这只是基础,但我很怀念.谢谢