List of Listings

Chapter 1. Reactive programming

Listing 1.1. The IObservable interface

Listing 1.2. The IObserver interface

Chapter 2. Hello, Rx

Listing 2.1. StockTicker class

Listing 2.2. StockTick class

Listing 2.3. StockMonitor class

Listing 2.4. StockInfo class

Listing 2.5. OnStockTick event handler checking the existence of a stock

Listing 2.6. OnStockTick event handler handling drastic price change

Listing 2.7. StockMonitor full code

Listing 2.8. Locked version of OnStockTick

Listing 2.9. Locked version of OnStockTick

Chapter 3. Functional thinking in C#

Listing 3.1. AreSimilar method uses a delegate as a parameter type

Chapter 4. Creating observable sequences

Listing 4.1. Handcrafted observable that pushes numbers

Listing 4.2. ConsoleObserver writes the observer actions to the console

Listing 4.3. SubscribeConsole extension method

Listing 4.4. ObservableConnection

Listing 4.5. Creating the ObservableConnction with an extension method

Listing 4.6. Creating the numbers observable with Observable.Create

Listing 4.7. Creating an observable that throws

Listing 4.8. Using the ToEnumerable operator

Listing 4.9. Using the ToList operator

Listing 4.10. Using the ToDictionary operator

Listing 4.11. Using the ToLookup operator

Listing 4.12. Freeing resources with the Using operator

Chapter 6. Controlling the observer-observable relationship

Listing 6.1. The Log operator

Listing 6.2. Reactive Draw application—full code

Chapter 7. Controlling the observable temperature

Listing 7.1. The ISubject interface

Listing 7.2. ISubject interface with Source and Result types that are the same

Listing 7.3. Subscribing the subject to multiple observables

Listing 7.4. The wrong way to merge observables

Listing 7.5. Converting Task<T> to an observable by using AsyncSubject

Listing 7.6. Limiting the ReplaySubject cache by time and size

Listing 7.7. Turning a cold observable hot

Listing 7.8. The IConnectableObservable interface

Listing 7.9. Reconnecting ConnectableObservable

Listing 7.10. Automatic disconnection with RefCount

Chapter 8. Working with basic query operators

Listing 8.1. Test program to simulate the creation of chat rooms and message emissions

Listing 8.2. Creating observable with Aggregate operator emitting second-largest item

Chapter 9. Partitioning and combining observables

Listing 9.1. Switching to the most recent search results with the Switch operator

Listing 9.2. Using Buffer to find the deltas between two speedometer readings

Chapter 10. Working with Rx concurrency and synchronization

Listing 10.1. The IScheduler interface

Listing 10.2. A test method to show the behavior of various schedulers

Listing 10.3. Delaying notifications with the Delay operator

Listing 10.4. Throttling notifications

Listing 10.5. Confusion from using SubscribeOn when unsubscribing

Listing 10.6. The LogWithThread operator logs both events and threads.

Listing 10.7. Testing the order of execution and effects of SubscribeOn and ObserveOn

Chapter 11. Error handling and recovery

Listing 11.1. Typical implementation of the observer’s OnError function

Listing 11.2. The WeakObserverProxy

Appendix C. Testing Rx queries and operators

Listing C.1. A basic unit test on an Rx operator

Listing C.2. A data-driven test of an Rx operator

Listing C.3. An example of a reactive unit test with the ReactiveTest base class

Listing C.4. An example of a reactive unit test that embeds the time dimension

Listing C.5. An example of a reactive unit test on a time-based operator

Listing C.6. Initial implementation of the MachineMonitor class

Listing C.7. Validating that 2 alerts are produced if the burst is longer than 5 seconds

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.192.120