Is there an async version of DirectoryInfo.GetFiles / Directory.GetDirectories in dotNet?

前端 未结 7 2101
北荒
北荒 2020-12-08 06:50

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 ver

相关标签:
7条回答
  • 2020-12-08 07:23

    I've used several times this approach to get Async objects from functions/procedures, and it always worked great:

    
    let AsyncGetDirectories path = 
        let fn = new Func<_, _>(System.IO.Directory.GetDirectories)
        Async.BuildPrimitive(path, fn.BeginInvoke, fn.EndInvoke)
    
    0 讨论(0)
提交回复
热议问题