开发者

Loop until file LastAccessTime is changed

I'm looking for a clever way to implement a while loop in C# that loops continously until FileInfo's LastAccessTime is changed.

I'm using a FileSystemWatcher to raise a change event where I do some wo开发者_StackOverflow中文版rk on the file, but this one fires as soon as I open the file.

Any ideas?


Have a look at the NotifyFilter property on the FileSystemWatcher. FileSystemWatcher does support looking at last access time.


FileSystemWatcher seems like the right way to do this. To only get notifications for LastWrite, set the NotifyFilter property to reflect that:

watcher.NotifyFilter = NotifyFilters.LastWrite;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜