Rx框架简介,及在观察者模式中的应用

Rx框架,即Reactive Framework,是一种异步通知机制,类似观察者模式但避免阻塞。它利用回调通知订阅者数据可用、错误和序列结束,支持Linq进行数据处理,并提供测试和时间相关操作。本文将介绍如何使用Rx创建、订阅序列,桥接.NET事件和异步模式,以及调度、测试和实现自定义操作符。

RX框架是Reactive Framework (Rx) ,它是一个异步通知的框架,有点类似观察者模式,只不过它是异步的,不会因为监听请求而阻塞通道

Why use Rx?

One of the advantages of using Rx with the observer pattern is that publishers in Rx run asynchronously, so that program execution does not get blocked while the publisher is busy retrieving data. Instead, callbacks are used to notify subscribers when data is available. Callbacks are also used to inform subscribers if there is an error and when the sequence has ended. This avoids the situation where subscribers are continuing to observe events that have either finished or faulted. Rx also facilitates the use of Linq for filtering, grouping and composing data and there are methods available for testing as well as carrying out time-related processing such as buffering and throttling.


说明文档: http://msdn.microsoft.com/en-us/library/hh242981(v=vs.103).aspx

Wiki地址:http://rxwiki.wikidot.com/start

Using Rx

2 out of 3 rated this helpful Rate this topic

This section includes topics that explain how you use Rx to create and subscribe to sequences, bridge existing .NET events and existing asynchronous patterns, as well as using schedulers. It also describes more advanced tasks such as testing and debugging an observable sequence, as well as implementing your own operators.

In This Section

Reference

RX在观察者模式中的应用: http://www.codeproject.com/Articles/773886/Implementing-the-Observer-Pattern-using-Rx


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值