14

I recently started working on Reactive Extensions, mostly observables at client side using Angular 2. The concept of observables of Rx and events of dotnet seems to be very similar. Are there any specific examples where one is applicable and other is not. If not, is there any other reason why Microsoft introduced Rx.Net, as observables stand at the core of Reactive Extensions. Any links or real time examples would suffice. Has it got something better to do with respect to async/await, tasks or threads? I am looking for differences threading/performance wise.

4

1 回答 1

22

它们是不同的抽象。此答案中的所有内容同样适用于 JavaScript 和 C#。

async/await允许你异步等待单个异步操作。这种“异步操作”只能完成一次,结果单一。

Observables 允许您订阅数据流,并对到达该流的数据做出反应。这种订阅模型允许随着时间的推移获得多项数据。

于 2017-07-15T10:24:48.830 回答