Reactive extensions for .NET (Rx .NET) for Windows Phone 8
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
This topic provides a brief intro to Reactive Extensions for .NET (Rx .NET) and describes the Rx .NET libraries available to your Windows Phone app. For more info about Rx .NET, see the Reactive Extensions developer center.
The reactive programming model
Rx .NET is a managed library that provides APIs for writing reactive, push-based apps. Reactive apps are driven by their environment. In the reactive model, data streams, asynchronous requests, and events are represented as observable sequences. The app can subscribe to these observable sequences to receive asynchronous messages as new data arrives. Reactive Extensions allows the app to compose these sequences using query operators.
If your app interacts with multiple sources of data, such as user input events, web services requests, and system notifications, the conventional way to manage all of these interactions is to implement separate handlers for each of these data streams. Inside these handlers, you must provide the code to coordinate between all of the different data streams and process this data into a useable form. Reactive Extensions allows you to write a query that combines all of these data streams into a single stream that triggers a single handler. The work of filtering, synchronizing, and transforming the data is performed by the Reactive Extensions query so that your handler can just react to the data it receives and do something with it.
For more info, see the Reactive Extensions developer documentation.
Rx .NET libraries
There are multiple Rx .NET libraries available for use with your Windows Phone app. The latest library uses the System.Reactive namespace and must be downloaded separately. The Microsoft.Phone.Reactive namespace is included with the SDK, but is recommended only for existing apps that already use those APIs. See the Reactive Extensions developer center for more info about the latest Rx .NET library.
For developing new apps, we recommend using the latest Windows Phone-compatible Rx .NET APIs.
The latest Rx .NET library uses the System.Reactive namespace. This library is an improved and extended version of the Reactive Extensions that is included with the Windows Phone SDK. The library resides in the System.Reactive namespace in order to prevent possible conflicts with Microsoft.Phone.Reactive. For more info about the System.Reactive APIs, see the Reactive Extensions developer documentation.
The Windows Phone SDK includes a Reactive Extensions library that uses the Microsoft.Phone.Reactive namespace. That library is recommended only for existing apps that already use those APIs. When developing a new app, we recommend using the System.Reactive APIs. For more info about the Microsoft.Phone.Reactive APIs, see the Microsoft.Phone.Reactive API reference.