更新时间:2021-09-24 09:21:59
在 F# 中,异步由 async
计算构建器表示,它不是 Task
的精确模拟>,但通常可以用来代替一个:
In F#, asynchrony is represented by the async
computation builder, which is not an exact analog of Task
, but can generally be used in place of one:
member public this.GetFooAsync (content : byte[]) =
async {
use stream = new MemoryStream(content)
return! this.bar.GetFooAsync(stream) |> Async.AwaitTask
}
|> Async.StartAsTask