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; searchRequest.Sources = SourceType.Image;
...and then would call ...