C#中filesystemwatcher使用的方法是什么
C#中FileSystemWatcher类使用的方法有:
1. `FileSystemWatcher()`:创建一个新的FileSystemWatcher实例。
2. `Dispose()`:释放由FileSystemWatcher对象使用的所有资源。
3. `BeginInit()`:开始初始化FileSystemWatcher对象。
4. `EndInit()`:完成初始化FileSystemWatcher对象。
5. `WaitForChanged(WatcherChangeTypes)`:阻塞线程,直到指定的文件或目录发生更改。
6. `Start()`:开始监视指定路径中的文件更改。
7. `Stop()`:停止监视指定路径中的文件更改。
8. `EnableRaisingEvents`:获取或设置一个值,指示是否启用FileSystemWatcher对象的事件。
9. `AddPath(string)`:将指定的路径添加到监视列表。
10. `RemovePath(string)`:从监视列表中移除指定的路径。
11. `OnChanged(EventArgs)`:引发Changed事件。
12. `OnCreated(EventArgs)`:引发Created事件。
13. `OnDeleted(EventArgs)`:引发Deleted事件。
14. `OnError(ErrorEventArgs)`:引发Error事件。
15. `OnRenamed(RenamedEventArgs)`:引发Renamed事件。
以上是FileSystemWatcher类的一些常用方法,可以根据需要使用。
下一篇:云主机换ip要重新搭建吗