Creating asynchronous operations with Rx
This recipe shows how to create Observable
from the asynchronous operations defined in other programming patterns.
Getting ready
To step through this recipe, you will need Visual Studio 2012. No other prerequisites are required. The source code for this recipe can be found at BookSamples\Chapter8\Recipe6
.
How to do it...
To understand how to create asynchronous operations with Rx, perform the following steps:
- Start Visual Studio 2012. Create a new C# Console Application project.
- Add reference to Reactive Extensions Main Library NuGet package. Refer to the Converting a collection to asynchronous observable recipe for details on how to do this.
- In the
Program.cs
file, add the followingusing
directives:using System; using System.Reactive; using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Threading; using System.Threading.Tasks; using System.Timers; using Timer = System.Timers.Timer;
- Add the following code snippet below the
Main...