Yul*_*a V 3 c# filesystemwatcher file
如果这个问题太简单,我很抱歉,我是这个主题的新手。
我正在创建一些文件,需要等到它们完成或直到经过一段时间(这就是我所说的超时)。
FileSystemWatcher 非常适合“等到它们完成”,但我看不到控制其寿命的参数。
使用Tread.Sleep似乎违背了目的 (?) - 如果它的使用是正确的,则FileSystemWatcher不会存在,我们只会Tread.Sleep while !File.Exists.
那么,实现它最简单的正确方法是什么?谢谢。
FileSystemWatcher.WaitForChanged 方法
MSDN系统
A synchronous method that returns a structure that contains specific information on the change that occurred, given the type of change you want to monitor and the time (in milliseconds) to wait before timing out.