O'Reilly logo

Programming Reactive Extensions and LINQ by Paul Betts, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hello Rx

The problem with creating your first Rx program is that if it is simple enough to qualify for the job, then it is too simple to do anything more useful than what could be done without it. The following is an example:

var input = Observable.Range(1,15); input.Subscribe(x => Console.WriteLine("The number is {0}", x));

As you'll learn in Chapter 3, the Range operator takes two parameters: a starting value and the number of values to generate. In this case, it will generate the numbers 1 through 15. The return of Observable.Range is of type IObservable of the inferred type int. If you hover over the input in the first line —in LINQPad or Visual Studio, but not, unfortunately, in this book—you will see that it is of the following type: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required