Programming Reactive Extensions and LINQ

Book description

Pro Reactive Extensions and LINQ is a deep dive into the next important technology for .NET developers: Reactive Extensions. This in-depth tutorial goes beyond what is available anywhere else to teach how to write WPF, Silverlight, and Windows Phone applications using the Reactive Extensions (Rx) to handle events and asynchronous method calls.

Reactive programming allows you to turn those aspects of your code that are currently imperative into something much more event-driven and flexible. For this reason, it's sometimes referred to as LINQ for Events.

Reactive programming hinges on the concept of the observable collection, as opposed to the simple enumerable collection with which we're all familiar. For example, to extract data from a collection and add it to a list box, you would traditionally iterate through the list box, extracting each object in turn. This approach works fine, but it requires significant knowledge about the data you're working with, which can be limiting. In Rx programming, you're instead informed about each object in turn and then free to react to each notification however you like, which affords much greater flexibility.

This book shows you how reactive programming can be applied to a range of situations—from WPF applications to Windows Phone apps—to improve coding efficiency and boost performance.

Table of contents

  1. Title
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Authors
  6. About the Technical Reviewer
  7. Acknowledgments
  8. Foreword
  9. Introduction
  10. Chapter 1: Introducing LINQ and Rx
    1. What LINQ Is
    2. What Rx Is
    3. Getting Rx and LINQ
    4. Distinguishing Rx and LINQ
    5. Why Bother?
    6. Choosing your IDE
    7. C# and .NET Fundamentals
    8. Hello LINQ
    9. Hello Rx
    10. Collections
    11. Summary
  11. Chapter 2: Core LINQ
    1. LINQ Syntax
    2. Core Operators
    3. Example: Parsing a Tab Separated File
    4. Summary
  12. Chapter 3: Core Rx
    1. IObservable and IObserver
    2. Example: Creating Observables
    3. Creating Observables from Events
    4. Rx Operators
    5. Example: Drag and Drop
    6. Summary
  13. Chapter 4: Practical Rx
    1. Implementing Asynchronous Calls
    2. Example: Programming Asynchronous Interactions With Rx
    3. Comparing the Traditional Begin/End approach to Rx.Net
    4. Summary
  14. Chapter 5: Inside Rx
    1. Window and Buffer
    2. Understanding Window: The Core Method
    3. Using Join Patterns
    4. Using Multicast, Publish and IConnectableObservable
    5. Understanding How IObservable Handles OnCompleted and OnError
    6. Implementing Your Own Operators
    7. Using Schedulers
    8. Summary
  15. Chapter 6: LINQ to SQL
    1. Introducing LINQ to SQL
    2. Using LINQ to SQL
    3. Using LINQ to SQL Joins, Cross Joins, and Outer Joins
    4. Using LINQ to SQL to Work with Relationships
    5. Example: Building a Windows Phone Application Using LINQ to SQL
    6. Summary
  16. Chapter 7: Reactive Extensions for JavaScript
    1. Understanding JavaScript and C# Differences
    2. Using a Browser Console to Explore RxJS
    3. Jumping into RxJS
    4. Integrating RxJS with jQuery DOM Events
    5. Example: Using jQuery DOM Events to Detect a Konami Code
    6. Adapting JavaScript APIs for RxJS
    7. Example: Using RxJS with HTML 5 Geolocation and DOM Events
    8. Using jQuery AJAX with RxJS
    9. Summary
  17. Chapter 8: ReactiveUI
    1. The Model-View-ViewModel Pattern
    2. Unpacking the ReactiveUI Library
    3. Implementing ViewModels with ReactiveObject
    4. ReactiveCommand
    5. Memorizing and Caching in ReactiveUI
    6. Calling Web Services in XAML Using ReactiveUI
    7. Example: Searching Asynchronously for Images with ReactiveUI
    8. Summary
  18. Chapter 9: Testing With Rx
    1. Mocking Async Methods
    2. Testing Async Methods with .First()
    3. Simulating the Elapse of Time
    4. Using Virtual Schedulers
    5. Example: Testing a ReactiveUI Application with Rx
  19. Index

Product information

  • Title: Programming Reactive Extensions and LINQ
  • Author(s):
  • Release date: October 2011
  • Publisher(s): Apress
  • ISBN: 9781430237471