About this Book

Rx.NET in Action is a full guide for the Reactive Extensions library for .NET developers. It delivers explanations, best practices, and tips and tricks that will allow you to fully use Rx in your applications.

Who should read this book

Rx.NET in Action is for .NET developers who write event-based and asynchronous applications and need powerful consuming and querying capabilities over events and push-based sources.

Rx.NET in Action is also suitable for developers who are curious about reactive programming and the Rx library techniques, but who may not have an immediate need to use it. Adding Rx know-how to your toolbox is valuable for future projects; reactive programing is a hot topic and will continue to be in the future.

This book primarily uses the .NET version of Rx, and the code examples use the C# language. Readers familiar with C# will be right at home.

This book is suitable for any platform supported by .NET (including .NET Core).

How this book is organized

The book’s 11 chapters are divided into two sections.

Part 1 provides an introduction to reactive programming and to the .NET skills you need in order to understand the functional aspects of the library.

  • Chapter 1 explores the reactive programming paradigm and Reactive Manifesto concepts. The chapter introduces the building blocks of Rx and explains when and why it should be used.
  • Chapter 2 is where you really meet Rx and the steps needed to incorporate it into your application. It shows a simple case-study of using Rx inside an application and compares two versions of the same application, before and after Rx is used.
  • Chapter 3 provides an overview of the functional programming concepts and techniques that Rx uses and how they’re provided with the .NET Framework and the C# language.

Part 2 dives into each of the tasks you’ll do with Rx—from creating observables and observers, to controlling their lifetimes and reacting to queries you create on top of them.

  • Chapter 4 teaches ways to create observable sequences and it shows how synchronous observables can be created from enumerables and built-in creation operators.
  • Chapter 5 explains the way Rx handles asynchronous code and how to bridge the native .NET asynchronous types into observables. This chapter also discusses the importance of asynchronous code in the modern application and how to add periodic behavior to your programs.
  • Chapter 6 concentrates on the observable-observer relationship and how to control it. In this chapter, I explain the best way to create observers for various scenarios and how to limit the lifetime of the observer subscription.
  • Chapter 7 explains the differences between hot and cold observables and introduces Rx subjects. This chapter teaches you how to control the state of the observable when observers subscribe to it and how to share emissions between the observers.
  • Chapter 8 provides a catalog of the basic query operators provided in the Rx library. Rx is often referred to as LINQ to Events, and knowing the details of the Rx operators will help you build powerful queries that will save you time and effort.
  • Chapter 9 continues where chapter 8 leaves off and shows advanced ways to partition and combine observables. You’ll learn how to group elements by condition or by coincidence and how to react to correlations between observables.
  • Chapter 10 delves deep into the Rx concurrency model and synchronization. I introduce the concept of schedulers and explain the schedulers Rx has to offer. Then I explain how to control the time and computation location of your Rx queries.
  • Chapter 11 teaches you to protect your Rx queries from faults and to react to errors that might happen in the query processing. This chapter also covers ways to manage resources that are consumed by the observables and the Rx queries.

The book also has three appendices:

  • Appendix A summarizes the concepts of asynchronous programming in .NET.
  • Appendix B presents the Rx Disposables library and explains how to use the utilities it provides.
  • Appendix C explains how to test Rx operators and queries.

The book is intended to be used as a guide and as a reference. If you’re new to Rx, I recommend reading from the beginning. If you’re already familiar with Rx concepts, you might find it useful to read a specific chapter based on the task you’re trying to accomplish.

About the code

This book contains many examples of source code both in numbered listings and inline with normal text. In both cases, source code is formatted in a fixed-width font like this to separate it from ordinary text. Sometimes code is also in bold to highlight code that has changed from previous steps in the chapter, such as when a new feature adds to an existing line of code.

In many cases, the original source code has been reformatted; we’ve added line breaks and reworked indentation to accommodate the available page space in the book. In rare cases, even this was not enough, and listings include line-continuation markers (). Additionally, comments in the source code have often been removed from the listings when the code is described in the text. Code annotations accompany many of the listings, highlighting important concepts.

The source code for this book is available to download from the publisher’s website (www.manning.com/books/rx-dot-net-in-action) and from GitHub (https://github.com/tamirdresher/RxInAction). Instructions for using this code are provided in the README file included in the repository root.

In the e-book, color is used in some listings and code snippets. Blue is used for primitive types and saved keywords. Aqua highlights user-defined types, and red is used for string literals. Brown is used for string parameters placeholders, and green is for comments. As always, black is user code.

Author Online

Purchase of Rx.NET in Action includes free access to a private web forum run by Manning Publications, where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum and subscribe to it, point your web browser at www.manning.com/books/rx-dot-net-in-action. This page provides information on how to get on the forum after you’re registered, the kinds of help available, and the rules of conduct on the forum.

Manning’s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the author can take place. It’s not a commitment to any specific amount of participation on the part of the author, whose contribution to the Author Online forum remains voluntary (and unpaid). We suggest you try asking him some challenging questions, lest his interest stray! The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

Other online resources

If you’re interested in Rx, you may also want to check out the Rx portal http://reactivex.io, which provides a Developer Center. It contains the most recent information about the library and its ports.

Rx.NET is an open source project, and you can find the full code and discussions at https://github.com/Reactive-Extensions/Rx.NET.

If you want to ask a question about Rx, you can visit the gitter channel (https://gitter.im/Reactive-Extensions/Rx.NET) or the slack #rx channel, which requires you to subscribe through the sign-up page for the .NET Core Slack Channel (http://tattoocoder.com/aspnet-slack-sign-up/).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.20.231