有没有在dotNet的DirectoryInfo.GetFiles / Directory.GetDirectories异步版本? [英] Is there an async version of DirectoryInfo.GetFiles / Directory.GetDirectories in dotNet?

查看:190
本文介绍了有没有在dotNet的DirectoryInfo.GetFiles / Directory.GetDirectories异步版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有在dotNet的DirectoryInfo.GetFiles / Directory.GetDirectories异步版本?我想用它们在F#异步块,并且它会是不错的一个,可以调用AsyncCallbacks版本。

Is there an asynchronous version of DirectoryInfo.GetFiles / Directory.GetDirectories in dotNet? I'd like to use them in an F# async block, and it'd be nice to have a version that can be called with AsyncCallbacks.

但问题是我想在一堆目录吸,很可能在SMB坐骑通过慢速网络连接,而我不希望一堆线程池中的线程坐等网络读取时,他们可以做其他的工作。

Problem is I'm trying to suck in a bunch of directories, probably on SMB mounts over slow network connections, and I don't want a bunch of thread pool threads sitting around waiting for network reads when they could be doing other work.

推荐答案

没有,我不觉得有什么。池线程的方法可能是最务实的。另外,我想你能下降至P / Invoke的 - 但是这将是一个的很多的更多的工作。

No, I don't think there is. The pool thread approach is probably the most pragmatic. Alternatively, I guess you could drop down to P/Invoke - but that would be a lot more work.

这篇关于有没有在dotNet的DirectoryInfo.GetFiles / Directory.GetDirectories异步版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆