Rx 中是否有等效于 Task.ContinueWith 的操作符? [英] Is there an equivalent of the Task.ContinueWith operator in Rx?
本文介绍了Rx 中是否有等效于 Task.ContinueWith 的操作符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Rx 中是否有等效的 Task.ContinueWith 操作符?
Is there an equivalent of the Task.ContinueWith operator in Rx?
我将 Rx 与 Silverlight 一起使用,我正在使用 FromAsyncPattern 方法进行两次 Web 服务调用,并且我想同步执行它们.
I'm using Rx with Silverlight, I am making two webservice calls with the FromAsyncPattern method, and I'd like to do them synchronously.
var o1 = Observable.FromAsyncPattern<int, string>(client.BeginGetData, client.EndGetData);
var o2 = Observable.FromAsyncPattern<int, string>(client.BeginGetData, client.EndGetData);
是否有一个操作符(如 Zip)只会在 o1 返回 Completed 之后 开始/订阅 o2?
我以相同的方式处理任一 Web 服务调用的失败.
Is there an operator (like Zip) that will only start / subscribe to o2 only after o1 returns Completed?
I handle failure of either web service call the same way.
推荐答案
是的,这叫做投影:
o1().SelectMany(_ => o2()).Subscribe();
这篇关于Rx 中是否有等效于 Task.ContinueWith 的操作符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文