This recipe will describe how to implement the IObservable<in T>
and IObserver<out T>
interfaces to get the custom Observable sequence and properly consume it.
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\Recipe2
.
To understand implementing the IObservable<in T>
and IObserver<out T>
interfaces to get the custom Observable sequence and consume it, perform the following steps:
Start Visual Studio 2012. Create a new C# Console Application project.
Add reference to the 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.Collections.Generic; using System.Reactive.Concurrency; using System.Reactive.Disposables; using System...