C# 如何监视文件变化的各事件
FileSystemWatcher watcher = new FileSystemWatcher(); // 如果改为 *.txt 等,就不能监视目录的变化 watcher.Filter = "*.*"; watcher.IncludeSubdirectories = true; watcher.Path = @"D:\"; watcher.Changed += new FileSystemEventHandler(OnChanged); watcher.Created += new FileSystemEventHandler(OnChanged); watcher.Deleted += new FileSystemEventHandler(OnChanged); watcher.Renamed += new RenamedEventHandler(OnFileRenamed);
用户评论
这是什么鬼?不是代码?txt文件用来骗积分?
挺实用,不错