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

Comparing the Traditional Begin/End approach to Rx.Net

We have asserted that the Rx example shown in Listing 4-7 is easier to maintain than a more traditional (non-Rx) approach. Let's dive a bit deeper into the differences between classic Begin/End asynchronous programming and Rx.

Were it not for Rx, the searchBingImageApi method would take a second parameter: a delegate for a callback method.

private void searchBingImageApi(string query, Action<string[]> callback)

The body of the method would set up the search...

SearchRequest searchRequest = new SearchRequest(); searchRequest.AppId = App.BingSearchKey; searchRequest.Query = query; searchRequest.Sources = new SourceType[1]; searchRequest.Sources[0] = SourceType.Image;

...and then would call ...

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