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 2015. No other prerequisites are required. The source code for this recipe can be found at BookSamples\Chapter8\Recipe2
.
To understand how to implement 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 2015. Create a new C# console application project.
Add a reference to the Reactive Extensions Main Library NuGet package. Refer to the Converting a collection to asynchronous observable recipe for more 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...