且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何转换为IEnumerable<任务< T>>到的IObservable< T>

更新时间:2021-12-14 07:58:59

我相信这将工作

tasks.Select(t => Observable.FromAsync(() => t))
     .Merge();

每个任务会送其结果的任何顺序完成可观察序列。您可以订阅的顺序和做任何你想要的结果的方式。

Each task will send its results to the observable sequence in whatever order they complete. You can subscribe to the sequence and do whatever you want with the results that way.