├── LICENSE
├── README.md
└── docs
├── about-the-author
├── README.md
├── img
│ └── xxifig01.jpg
└── index.html
├── about-the-cover-illuatration
├── README.md
└── index.html
├── about-this-book
├── README.md
├── img
│ └── enter.jpg
└── index.html
├── acknowledgments
├── README.md
└── index.html
├── appendix-a
├── README.md
└── index.html
├── appendix-b
├── README.md
└── index.html
├── appendix-c
├── README.md
└── index.html
├── catalog-of-rx-operators
├── README.md
└── index.html
├── foreword
├── README.md
└── index.html
├── index.html
├── part1
├── 1
│ ├── README.md
│ └── index.html
├── 2
│ ├── README.md
│ └── index.html
├── 3
│ ├── README.md
│ └── index.html
├── README.md
└── index.html
├── part2
├── 4
│ ├── README.md
│ └── index.html
├── 5
│ ├── README.md
│ └── index.html
├── 6
│ ├── README.md
│ └── index.html
├── 7
│ ├── README.md
│ └── index.html
├── 8
│ ├── README.md
│ └── index.html
├── 9
│ ├── README.md
│ └── index.html
├── 10
│ ├── README.md
│ └── index.html
├── 11
│ ├── README.md
│ └── index.html
├── README.md
└── index.html
└── preface
├── README.md
└── index.html
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Rx.NET in Action 中文版
2 |
3 | 原著:Tamir Dresher 著, [MANNING](https://www.manning.com/) 出版, 2017
4 |
5 | 译文:[Alex Lewis](https://alexinea.com) [@translation.liuyi.work](https://translation.liuyi.work/rx-net-in-action-manning2017), 2019
6 |
7 | 出版社站点:[https://www.manning.com/books/rx-dot-net-in-action](https://www.manning.com/books/rx-dot-net-in-action)
8 |
9 | 在亚马逊购买:[https://www.amazon.com/Rx-NET-Action](https://www.amazon.com/Rx-NET-Action-examples-Tamir-Dresher/dp/1617293067/)
10 |
11 | ## 目录
12 |
13 | - [序](docs/foreword/)(完成)
14 | - [前言](docs/preface/)(完成)
15 | - [致谢](docs/acknowledgments/)(完成)
16 | - [关于本书](docs/about-this-book/)(完成)
17 | - [关于作者](docs/about-the-author/)(完成)
18 | - [关于封面图画](docs/about-the-cover-illuatration/)(完成)
19 | - [第一部分:入门](docs/part1/)
20 | - [第一章 反应式编程](docs/part1/1/)
21 | - [第二章 你好,Rx](docs/part1/2/)
22 | - [第三章 C# 的函数式思想](docs/part1/3/)
23 | - [第二部分:核心概念](docs/part2/)
24 | - [第四章 创建可观察对象序列](docs/part2/4/)
25 | - [第五章 从 .NET 异步类型创建可观察对象](docs/part2/5/)
26 | - [第六章 Controlling the observer-observable relationship](docs/part2/6/)
27 | - [第七章 Controlling the observable temperature](docs/part2/7/)
28 | - [第八章 使用基础查询运算符](docs/part2/8/)
29 | - [第九章 Partitioning and combining observables](docs/part2/8/)
30 | - [第十章 使用 Rx 处理并发与同步](docs/part2/10/)
31 | - [第十一章 错误处理与恢复](docs/part2/11/)
32 | - [附录一](docs/appendix-a/)
33 | - [附录二](docs/appendix-b/)
34 | - [附录三](docs/appendix-c/)
35 | - [Rx 操作符清单](docs/catalog-of-rx-operators/)
36 |
37 | ## 关于此书
38 |
39 | > **_Keep a copy of this book handy to put Rx.NET into action!_** —— From the Foreword by Erik Meijer, Inventor of Rx
40 |
41 | ### 关于技术
42 |
43 | 现代应用程序必须对来自诸如用户与系统事件、内部消息、传感器等的数据流做出反应(react)。Reactive Extensions(Rx,反应式扩展)是一个包含 600 多个运算符的 .NET 库,开发人员可以将这些运算符组合在一起,构建出反应式客户端和服务端应用,以在响应性、伸缩性和弹性(responsiveness, resiliency, and elasticity)方面最大化的方式异步处理事件。
44 |
45 | ### 关于本书
46 |
47 | 开发人员可以通过阅读 _Rx.NET in Action_ 学习使用 Rx 库构建事件驱动的应用程序。全书始于概述基于 Rx 的反应式应用(Rx-based reactive applications)的设计和架构,深入代码示例,令你第一时间领略 Rx 的丰富查询功能,Rx 并发模型方便你异步控制代码和运行事件处理程序。你还会学到如何使用事件流(event streams),如何使用调度器(schedulers)管理时间,以及如何对事件进行筛选、转换和分组。
48 |
49 | ### 包含内容
50 |
51 | - C# 中的 Rx 简介
52 | - 创建并使用数据流和事件
53 | - 在事件流上构建复杂查询
54 | - 错误处理和测试
55 |
56 | ### 关于读者
57 |
58 | 读者应理解 OOP 概念,并能在 C# 中轻松边写代码。
59 |
60 | ### 关于作者
61 |
62 | Tamir Dresher ,高级软件架构师,目前供职于 [CodeValue](https://codevalue.net/) ,是以色列微软编程社区的重要成员。
63 |
--------------------------------------------------------------------------------
/docs/about-the-author/README.md:
--------------------------------------------------------------------------------
1 | # 关于作者
2 |
3 |
4 |
5 | TAMIR DRESHER,高级软件架构师(senior software architect),在以色列 CodeValue 公司担任顾问(consultant)。作为微软编程社区(Microsoft programming community)的重要成员,他经常在开发者大会(developers conferences)上讨论软件开发主题,并在 Ruppin Academic Center 担任软件工程讲师(lecturer for software engineering)。
6 |
7 | 作为一名资深 .NET Framework 和软件技巧专家,Tamir 培训了数百名开发人员,并为许多企业和公共部门的知名客户提供帮助。
8 |
9 | Tamir 从 Rx 诞生时便开始使用 Rx,并与之结下不解之缘。作为一名 Rx 的早期使用者,Tamir 非常了解 Rx 类库的内部实现,他经常会饶有兴趣地为其他开发者解释 Rx 并帮助他们利用反应式编程范例(reactive programming paradigm)的强大功能提高他们的编程技巧。
10 |
11 | Tamir 在他的博客 [www.tamirdresher.com](www.tamirdresher.com) 上记录了不少他搬砖的经历。
12 |
--------------------------------------------------------------------------------
/docs/about-the-author/img/xxifig01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/about-the-author/img/xxifig01.jpg
--------------------------------------------------------------------------------
/docs/about-the-author/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/about-the-author/index.html
--------------------------------------------------------------------------------
/docs/about-the-cover-illuatration/README.md:
--------------------------------------------------------------------------------
1 | # 关于封面图画
2 |
3 | _Rx.NET in Action_ 封面图片已标明为「Habit of a Bonza or Priest in China.」插图来自伦敦 Thomas Jefferys 出版社于 1757 年至 1772 年间出版的 _A Collection of the Dresses of Different Nations, Ancient and Modern (four volumes)_。封面使用手工彩色铜版雕刻绘画,并用 gum arabic 进行了增强处理。托马斯·杰弗里斯(Thomas Jefferys,1719-1771)被称作「乔治三世的地理学家(Geographer to King George III.)」。他是一位英国制图师,是当时主要的地图供应商,他为政府和其它官方机构刻制打印地图,制作了许多商业地图和舆图(commercial maps and atlases),特别是北美地区的地图。他作为制图者的成果引发了人们对地图中各地服饰与风俗习惯的兴趣,这些都体现在了这本画册中。
4 |
5 | 在 18 世纪后期,世界(译者注:此处是指西方世界)兴起了一股对探索和旅行遥远土地的风潮,因此这类为其他国家居民和旅行者介绍他国风俗的图册极受人们欢迎。杰弗里斯通过书中的绘画生动形象地介绍了大约 200 年前世界各国的风俗。从那时起,各国各地区的许多独有的的服饰发生了变化,多样性的风俗逐渐消亡。直至今日,我们很难直接区分两块大陆上的居民。也许应该乐观看待这一问题,我们将多样性的风俗和生活方式、甚至是多样性的科技人文生活传播到远方。
6 |
7 | 很难把这些内容与一本计算机类的图书产生联系,不过 Manning 以两百年前各地多样性的风俗来体现计算机领域的创造性和能动性,通过杰弗里斯的绘画重拾昔日精彩。
8 |
--------------------------------------------------------------------------------
/docs/about-the-cover-illuatration/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/about-the-cover-illuatration/index.html
--------------------------------------------------------------------------------
/docs/about-this-book/README.md:
--------------------------------------------------------------------------------
1 | # 关于本书
2 |
3 | _Rx.NET in Action_ 为开发人员提供了完整的 Reaction Extensions 指南。本书包含有理论讲解、最佳实践和使用技巧,让你在开发中充分领略 Rx 之美。
4 |
5 | ## 谁需要这本书
6 |
7 | _Rx.NET in Action_ 适用于需要编写这类应用程序的 .NET 开发人员:基于事件(event-based)和异步(asynchronous)、需要在事件和基于推送(push-based)的源上提供较强处理与查询能力等。
8 |
9 | 本书同样适用于对反应式编程(reactive programming)和 Rx 技术感兴趣、但暂时不会使用这门技术的开发人员。将 Rx 技术加入到你的技术栈内对你未来的项目非常有用,反应式编程是一个热门话题,这种热门还将持续很久。
10 |
11 | 本书主要是用 .NET 版本的 Rx,代码示例使用 C# 语言,熟悉 C# 的读者会觉得宾至如归。
12 |
13 | 本书适用于所有 .NET 支持的平台(包括 .NET Core)。
14 |
15 | ## 本书结构
16 |
17 | 本书计有两大部分,列 11 章。
18 |
19 | 第一部分介绍反应式编程和必须的 .NET 技能,以便能掌握 Rx 的功能使用。
20 |
21 | - **第 1 章** 探讨反应式编程范式,介绍反应式宣言(Reactive Manifesto)。该章节介绍使用 Rx 并解释为何使用、何时使用 Rx 的问题
22 | - **第 2 章** 初次接触 Rx,并一步步引导如何使用 Rx。该章节提供有一个简单的例子,该例将展示引入 Rx 前后应用程序的不同
23 | - **第 3 章** 概述 Rx 使用的函数式编程(functional programming)理论和技术,并介绍它们如何在 .NET Framework 和 C# 语言中实现的。
24 |
25 | 第二部分深入探究 Rx 的更多细节,从创建可观察对象(observables)和观察者(observers),到控制其生命周期(lifetimes)以及对在其上创建的查询的反应。
26 |
27 | - **第 4 章** 介绍创建可观察序列(observable sequences)的方法,并展示如何通过 enumerables 和内建(built-in)创建运算符(creation operators)创建同步可观察对象(synchronous observables)
28 | - **第 5 章** 介绍 Rx 处理异步代码的方法,以及如何将原生 .NET 异步类型(native .NET asynchronous types)桥接(bridge)到可观察对象。该章节还将讨论异步代码在现代应用程序中的重要性,以及如何在应用程序中加入定时行为(periodic behavior)。
29 | - **第 6 章** 讨论可观察对象和观察者的关系(observable-observer relationship)以及如何控制它。该章节将介绍多种场景下创建观察者的最佳方法,以及如何限制观察者订阅(subscription)的生命周期。
30 | - **第 7 章** 探讨冷热可观察对象的区别,介绍 Rx subject。该章节介绍如何在为观察者订阅可观察对象时控制该可观察对象的状态,以及如何在观察者之间共享结果
31 | - **第 8 章** 介绍 Rx 中的基本查询运算符。Rx 通常被称作 LINQ to Events,了解 Rx 运算符的细节有助于构建功能强大的查询,从而节省开发者的时间和精力
32 | - **第 9 章** 接着第 8 章的内容,讲解可观察对象的分区和组合等高级方法。该章节将介绍如何通过条件对元素进行分组,以及如何对相关可观察对象做出反应
33 | - **第 10 章** 深入探讨 Rx 并发模型(concurrency model)和同步(synchronization)。该章节将介绍调度器(schedulers)概念、Rx 所提供的的调度器,以及介绍如何控制 Rx 查询的时间和运算位置。
34 | - **第 11 章** 探讨 Rx 查询如何免受错误的影响,并对查询处理(query processing)过程中可能发生的错误做出反应。该章节还涵盖了如何管理可观察对象和 Rx 查询所使用的资源
35 |
36 | 本书还有三个附录:
37 |
38 | - **附录一** 总结 .NET 异步编程概念
39 | - **附录二** 介绍 Rx Disposables 及其使用方法
40 | - **附录三** 介绍如何测试 Rx 运算符和查询
41 |
42 | 本书旨在用作指南和参考。如果你是新手,我建议你从头阅读。如果你已熟悉 Rx 的概念,则可根据实际情况翻阅特定章节。
43 |
44 | ## 关于代码
45 |
46 | 本书包含大量示例代码,代码以等宽字体印刷,以区别于普通文本。有时代码会加粗,用来表示相关代码已发生变更,比如在现有代码中添加新功能。
47 |
48 | 本书多处源码在印刷时进行了重新排版,通过添加换行符、重写缩进等以适应图书纸张的可用空间。还有少数几处会更加极端,不得不使用特殊的换行符号(
)。此外,在文本中使用的代码会把源码中的注释移除,这些注释用于突出重点。
49 |
50 | 本书源码可在出版社网站(www.manning.com/books/rx-dot-net-in-action)和 GitHub(https://github.com/tamirdresher/RxInAction)下载。GitHub 仓库(repository)的 README 文件给出了源码使用的说明。
51 |
52 | 本书电子版会为列表和代码片段进行代码着色。蓝色(blue)用于基础类型(primitive types)和关键字(keywords),水色(aqua)用于突出用户定义的类型,红色(red)用于字符串文字,棕色(brown)用于字符串参数占位符,绿色(green)用于注释,黑色(black)为用户代码。
53 |
54 | ## 作者在线社区
55 |
56 | 当你购买本书时,你同时获得了免费访问由 Man 宁 出版社提供的私有在线社区的权限,你可以在该社区内对本书进行评论、提出技术问题,并从作者和其他用户那里获得帮助。你可以通过 www.manning.com/books/rx-dot-net-in-action 访问社区或订阅社区。该页面同时还提供了有关诸如「如何在注册后访问社区」、「实用帮助」和「社区规定」等信息。
57 |
58 | Manning 出版社对读者的承诺是提供一个让读者可以与作者和其他读者进行沟通的平台,但这并不是绝对的,作者和读者在在线社区的贡献都是他们自愿且无偿的。我们建议你提出一些有挑战性的问题来吸引大家的注意。一旦本书出版,你就可以在出版社的站点上浏览作者的在线版块以及历史存档。
59 |
60 | 曼宁对读者的承诺是提供一个场所,让读者之间以及读者与作者之间进行有意义的对话。 这并不是对作者任何具体参与
61 |
62 | ## 其它线上资源
63 |
64 | 如你对 Rx 很感兴趣,你可以访问 Rx 门户站点 http://reactivex.io,它提供有 Rx 开发者中心,包含了 Rx 库和这一领域的其它最新资讯。
65 |
66 | Rx.NET 是一个开源项目,可以在 https://github.com/Reactive-Extensions/Rx.NET 查阅完整代码额讨论。
67 |
68 | 如果你有就 Rx 提问,可以访问我们的 gitter 频道(https://gitter.im/Reactive-Extensions/Rx.NET)或者 slack 的 #rx 频道(需要在 .NET Core Slack 频道 http://tattoocoder.com/aspnet-slack-sign-up/ 进行注册)。
69 |
--------------------------------------------------------------------------------
/docs/about-this-book/img/enter.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/about-this-book/img/enter.jpg
--------------------------------------------------------------------------------
/docs/about-this-book/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/about-this-book/index.html
--------------------------------------------------------------------------------
/docs/acknowledgments/README.md:
--------------------------------------------------------------------------------
1 | # 致谢
2 |
3 | 本书献给我的非凡妻子 Gabriela,本书的成书离不开你的支持和鼓励。即便我忙于写作,我依旧爱着你并感谢你的付出。
4 |
5 | 感谢我的孩子 Shira 与 Yonatan,你们为我的生活带来了光明与欢乐。亲爱的孩子们,我爱你们。在你们睡着时我坐在你们身旁,你们为我许多章节带来了灵感。
6 |
7 | 感谢我的父母 Ester 和 Shlomo,他们为我购买了我人生中的第一台电脑,彻底点燃了我对计算机科学(computer science)的热情。
8 |
9 | 感谢我的堂兄 Guy,你对我如今的生活以及看待万事万物的方式产生了巨大影响,我大部分的软件功能都源自你教会我的那些东西。
10 |
11 | 感谢我所有的家人们,当你们与我交谈时,我的思绪依旧停留在这本书的写作之上,感谢你们对我的理解和付出的一切。
12 |
13 | 特别要感谢我的好基友 Dror Helper,他甚至都不知道他给了我许多关于这本书的灵感。
14 |
15 | 还要感谢我 CodeValue 公司的所有同事们,他们在我写作中提供了许多帮助。
16 |
17 | 特别感谢 Erik Meijer 大神为本书作序,当然也要感谢他的 Rx。
18 |
19 | 感谢 Manning 出版社的工作人员们。在编辑、制作和推广方面与我合作的所有人,无论你们是直接参与或是身处幕后,你们的努力都为这本书的诞生提供了帮助。这是团结的力量。
20 |
21 | 感谢许多在写作和开发阶段提供反馈的审读者们:Bruno Sonnino,Bachir Chihani,CarstenJørgensen,Dror Helper,Edgar Knapp,Fabrizio Cucci,Goetz Heller,Ignacio Rigoni,Jason Hales,Joel Kotarski,Jorge Branco,Mattias Lundell ,Michele Mauro,Oscar Vargas,Rohit Sharma 和 Stephen Byrne。还要感谢技术校对(technical proofreader)Cody Sand,他仔细审阅了最终稿的所有示例代码。
22 |
23 | 最后要感谢 Rx 团队和她的全体贡献者(contributors)们,感谢你们构建了这门精彩的技术。
24 |
--------------------------------------------------------------------------------
/docs/acknowledgments/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/acknowledgments/index.html
--------------------------------------------------------------------------------
/docs/appendix-a/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/appendix-a/README.md
--------------------------------------------------------------------------------
/docs/appendix-a/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/appendix-a/index.html
--------------------------------------------------------------------------------
/docs/appendix-b/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/appendix-b/README.md
--------------------------------------------------------------------------------
/docs/appendix-b/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/appendix-b/index.html
--------------------------------------------------------------------------------
/docs/appendix-c/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/appendix-c/README.md
--------------------------------------------------------------------------------
/docs/appendix-c/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/appendix-c/index.html
--------------------------------------------------------------------------------
/docs/catalog-of-rx-operators/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/catalog-of-rx-operators/README.md
--------------------------------------------------------------------------------
/docs/catalog-of-rx-operators/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/catalog-of-rx-operators/index.html
--------------------------------------------------------------------------------
/docs/foreword/README.md:
--------------------------------------------------------------------------------
1 | # 序
2 |
3 | 本书详尽介绍了 .NET 开发人员高效使用 Rx 所需的细节和背景知识,特别是如何在 .NET 中繁多的异步类型与 Rx 可观察对象(Rx observables)间建立联系,以及如何处理错误(errors)、资源分配(resource allocation)和并发(concurrency)问题
4 |
5 | 一直以来,.NET Framework 都一直在强调异步执行(asynchronous execution)和非阻塞 I/O(nonblocking I/O)的重要性。通过委托(delegates),.NET Framework 始终都在强调高阶函数式编程(higher-order functional programming),通过在委托上自动定义 `BeginInvoke` 和 `EndInvoke` 方法,开发者得以异步调用任何方法(call any method asynchronously)。
6 |
7 | 但对异步操作(asynchronous operations)来说,BeginInvoke/EndInvoke 模式过于繁琐冗长,需要对代码进行 CPS 变换(continuation-passing style)(译者注:CPS 变换是一种编程风格,用于将内部要执行的逻辑封装到一个闭包内,并将之返回给调用者。通过将控制流程显式暴露给调用者达到控制的目的)。为了改善这一点,基于 .NET 内置的事件(events)与事件处理程序(event handlers),.NET Framework 引入了基于事件的异步模式(event-based asynchronous pattern)。尽管相比于异步委托(asynchronous delegates),基于事件的模式向前跨了一大步,但还有进一步改进的空间。
8 |
9 | 相对于通过标准 Enumerable/IEnumerator 接口来处理同步流(synchronous streams)的值,LINQ 标准查询运算符(LINQ standard query operators)以更为高级和声明式的形式给出了优雅美观地处理流的答案。如果我们把事件在概念上也当做是一种流的值,就可以通过一种类似的基于 LINQ 的编程模型来处理事件,那岂不美哉?
10 |
11 | 对事件进行异步调用的另一个弊端是与大多数事件(如鼠标点击事件)不同的是,结合了异步操作的事件只会返回单个值。所以,如果能通过异步方法返回的单个值就能提供类似命令式编程(imperative programming)模型来支持常规控制流条件(regular control-flow-like conditionals)、循环(loops)以及异常处理(exception handling),那岂不美哉?
12 |
13 | 实践证明,上述两个问题的答案都是肯定的。通过运用某些运算技巧得到的等价关系,我们可以将同步的基于流拉取(synchronous pull-based streams)的 IEnumerable/IEnumerator 接口转换为单体的异步的基于流推送(asynchronous push-based streams)的 IObservable/IObserver 接口。C# 和 VB 中的 async/await 语法让开发人员能够用常规的命令式语法(imperative syntax)编写同步方法和异步方法,LINQ 查询解析(LINQ query comprehensions)则允许开发人员们在同步数据流和异步数据流上进行查询。
14 |
15 | 这就是 Rx 的初心。那些非 .NET 技术栈的语言都不得不采用「一个/多个 x 同步/异步」这样的组合来做相同的事。使开发人员心情愉悦地高效完成工作的,毫无疑问取决于他们所使用的语言。
16 |
17 | 如果您是一位清真的 .NET 开发人员,你就一定要保留这本书,并将 Rx.NET 付诸实践!
18 |
19 | —— Erik Meijer,“Rx 之父”,[Applied Duality](http://www.applied-duality.com/) 创始人
20 |
--------------------------------------------------------------------------------
/docs/foreword/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/foreword/index.html
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/index.html
--------------------------------------------------------------------------------
/docs/part1/1/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part1/1/README.md
--------------------------------------------------------------------------------
/docs/part1/1/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part1/1/index.html
--------------------------------------------------------------------------------
/docs/part1/2/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part1/2/README.md
--------------------------------------------------------------------------------
/docs/part1/2/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part1/2/index.html
--------------------------------------------------------------------------------
/docs/part1/3/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part1/3/README.md
--------------------------------------------------------------------------------
/docs/part1/3/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part1/3/index.html
--------------------------------------------------------------------------------
/docs/part1/README.md:
--------------------------------------------------------------------------------
1 | # 第一部分 入门
2 |
3 | 什么是反应式应用(reactive applications)?有何作用?Reactive Extensions (Rx) 是如何改变编程方式的?在使用 Rx 之前需要做什么准备?为何 Rx 比传统的事件驱动编程(event-driven programming)更好?这是我们前三章所讨论的问题。
4 |
5 | 通过学习,你会了解什么是反应式体系(reactive systems)、什么是反应式应用,以及为何要关注这些的原因。通过真实例子来创建 Rx 应用程序并如何亲自动手。你还将学习到 Rx 背后所基于的函数是编程(functional programming)的基础,以便于理解本书介绍的其它概念。
6 |
--------------------------------------------------------------------------------
/docs/part1/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part1/index.html
--------------------------------------------------------------------------------
/docs/part2/10/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/10/README.md
--------------------------------------------------------------------------------
/docs/part2/10/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/10/index.html
--------------------------------------------------------------------------------
/docs/part2/11/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/11/README.md
--------------------------------------------------------------------------------
/docs/part2/11/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/11/index.html
--------------------------------------------------------------------------------
/docs/part2/4/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/4/README.md
--------------------------------------------------------------------------------
/docs/part2/4/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/4/index.html
--------------------------------------------------------------------------------
/docs/part2/5/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/5/README.md
--------------------------------------------------------------------------------
/docs/part2/5/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/5/index.html
--------------------------------------------------------------------------------
/docs/part2/6/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/6/README.md
--------------------------------------------------------------------------------
/docs/part2/6/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/6/index.html
--------------------------------------------------------------------------------
/docs/part2/7/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/7/README.md
--------------------------------------------------------------------------------
/docs/part2/7/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/7/index.html
--------------------------------------------------------------------------------
/docs/part2/8/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/8/README.md
--------------------------------------------------------------------------------
/docs/part2/8/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/8/index.html
--------------------------------------------------------------------------------
/docs/part2/9/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/9/README.md
--------------------------------------------------------------------------------
/docs/part2/9/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/9/index.html
--------------------------------------------------------------------------------
/docs/part2/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/README.md
--------------------------------------------------------------------------------
/docs/part2/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/part2/index.html
--------------------------------------------------------------------------------
/docs/preface/README.md:
--------------------------------------------------------------------------------
1 | # 前言
2 |
3 | .NET 的反应式扩展(Reactive Extensions,Rx)首发于 2009 年 11 月,当时是如此介绍的:「Rx 允许开发者编写精炼的声明式代码(declarative code),通过 .NET 常用的方式方法编排(orchestrate)和协调(coordinate)异步的和基于事件的程序」。(参考 [http://mng.bz/gQ31](http://mng.bz/gQ31))
4 |
5 | 我还记得我初次接触 Rx 的例子和讨论的样子。我吃惊于这些解决方案的优雅与精炼。然而当我尝试使用 Rx 时,我却发现反应式编程(reactive programming)并不简单,我必须转变自己的思维方式。在那段岁月中,有关 Rx 主题的资料并不多,我必须通过不断解决遇到的问题并反复实践来学习 Rx。
6 |
7 | 2012 年我退役并加入 [CodeValue](www.codevalue.net),当时我有两个主要项目让我真正领会到了 Rx 的精髓。第一个项目是一个有关网络安全(cybersecurity)的程序,要求对多个事件(multiple events)做出反应并协调它们的工作,以便为终端用户(the end user)显示这些并行运行的各事件的状态。第二个项目是有关视频聊天(video chat)的,它需要在移动端和 PC 端设备上运行。视频聊天程序需要对诸如用户登录登出、接受各类须以不同方式加以处理的消息等做出响应。尽管这是两个不同的系统,但它们都需要基于事件地写流(writing a flow based on events),这其中涉及到在流中对接收值过滤(filtering of received values)、对异步(asynchronicity)和并发(concurrency)的处理以及对重复事件的识别模式等,以便应用程序可以有效并正确地响应(respond efficiently and correctly)。我为这两个项目引入了 Rx,并为此大获成功——无论是效果还是开发进度上都超出了我们的预料。
8 |
9 | 尽管我对 Rx 已经有所了解,但在使用时仍频繁踩坑,而且关于 Rx 的资料真的太少了,不管是书还是文章。很多次掉坑里的原因是我的同事们缺乏对新事物的了解。幸运的是,在我找出问题根源后,问题往往很容易修复,这也是拜 Rx 的灵活性所赐。在随后的的几年中,我开始通过博客介绍 Rx 以及如何轻松解决复杂问题。这也是本书写作的动力。我打算创建一个循序渐进的指南(step-by-step guide),其中包含有 .NET 工程师们所需要学习的部分,以便最大限度地利用 Rx 库和反应式编程范例(the reactive programming paradigm)。同时我还会记录一些我多年来的实践经验,包括所遇到的陷阱以及相应的解决方案。
10 |
11 | 为了确保能让本书达到我的目的,我需要十分细心。为了能突显重点,我不得不重写一些章节、改变一些主题,并筛除了一部分素材,最后诞生了你此刻手上的这本书——Rx.NET in Action。这本书可以从前向后一章章阅读,也可以直接阅读特定章节来解决问题或加深记忆。
12 |
13 | Rx 还在不断发展,它被移植到了许多其它语言和平台中。Rx 是 [.NET 基金会(.NET Foundation)](www.dotnetfoundation.org) 的开源项目。我希望 Rx 能成为一种 .NET 编写、编排、协调异步和基于事件的程序的事实标准(de facto way),本书将为你提供打开 Rx 新世界大门所需的一切。
14 |
--------------------------------------------------------------------------------
/docs/preface/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xixixixixiao/rx-net-in-action-manning2017/294f584355ca407e01e6309012559a78ed814b8b/docs/preface/index.html
--------------------------------------------------------------------------------