TPL VS无框架 [英] TPL vs Reactive Framework

查看:127
本文介绍了TPL VS无框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当总会有选择使用接收了第三方物流或者是2框架正交?

When would one choose to use Rx over TPL or are the 2 frameworks orthogonal?

据我了解接收的主要目的是提供一个抽象过的事件,并允许成分,但它也可以提供一个抽象了异步操作。 通过配置了IDisposable返回使用Createxx重载和Fromxxx过载和取消。

From what I understand Rx is primarily intended to provide an abstraction over events and allow composition but it also allows for providing an abstraction over async operations. using the Createxx overloads and the Fromxxx overloads and cancellation via disposing the IDisposable returned.

TPL还提供了操作的抽象,通过任务和取消的能力。

TPL also provides an abstraction for operations via Task and cancellation abilities.

我的困境是,当要使用的和什么情况下?

My dilemma is when to use which and for what scenarios?

推荐答案

RX的主要目的不是提供一个抽象过的事件。这仅仅是它的成果之一。其主要目的是提供一个组合的推模式的集合。

The main purpose of Rx is not to provide an abstraction over events. This is just one of its outcomes. Its primary purpose is to provide a composable push model for collections.

反应性框架(RX)是基于的IObservable< T> 作为数学双的IEnumerable的< T> 。因此,而不是拉使用来自集合项的IEnumerable< T> 我们可以通过的IObservable&LT有对象推给我们; T>

The reactive framework (Rx) is based on IObservable<T> being the mathematical dual of IEnumerable<T>. So rather than "pull" items from a collection using IEnumerable<T> we can have objects "pushed" to us via IObservable<T>.

当然,当我们真正去寻找可观察到的源之类的活动及放大器;异步操作是优秀的候选人。

Of course, when we actually go looking for observable sources things like events & async operations are excellent candidates.

的反应性框架自然需要一个多线程模型,以便能够观看观察数据的来源,并管理查询和预订。实际上接收大量使用第三方物流来做到这一点。

The reactive framework naturally requires a multi-threaded model to be able to watch the sources of observable data and to manage queries and subscriptions. Rx actually makes heavy use of the TPL to do this.

所以,如果你使用接收你隐式使用TPL。

So if you use Rx you are implicitly using the TPL.

您会使用第三方物流直接,如果你想直接控制任务。

You would use the TPL directly if you wish direct control over your tasks.

但如果你有数据,你要遵守和履行对再查询来源我全力推荐的反应框架。

But if you have sources of data that you wish to observe and perform queries against then I thoroughly recommend the reactive framework.

这篇关于TPL VS无框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆