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 ...

Get Programming Reactive Extensions and LINQ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.