Skip to Content
Programming C# 10
book

Programming C# 10

by Ian Griffiths
August 2022
Intermediate to advanced
833 pages
25h 30m
English
O'Reilly Media, Inc.
Book available
Content preview from Programming C# 10

Chapter 11. Reactive Extensions

The Reactive Extensions for .NET (usually shortened to Rx) are designed for working with asynchronous and event-based sources of information. Rx provides services that help you orchestrate and synchronize the way your code reacts to data from these kinds of sources. We already saw how to define and subscribe to events in Chapter 9, but Rx offers much more than these basic features. It provides an abstraction for event sources that has a steeper learning curve than events, but it comes with a powerful set of operators that makes it far easier to combine and manage multiple streams of events than is possible with the free-for-all that delegates and .NET events provide. Microsoft has also made an associated set of libraries called Reaqtor available that builds on the foundation of Rx to provide a framework for reliable, stateful, distributed, scalable, high-performance event processing in services.

Rx’s fundamental abstraction, IObservable<T>, represents a sequence of items, and its operators are defined as extension methods for this interface. This might sound a lot like LINQ to Objects, and there are similarities—not only does IObservable<T> have a lot in common with IEnumerable<T>, but Rx also supports almost all of the standard LINQ operators. If you are familiar with LINQ to Objects, you will also feel at home with Rx. The difference is that in Rx, sequences are less passive. Unlike IEnumerable<T>, Rx sources do not wait to be asked for their ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming C# 8.0

Programming C# 8.0

Ian Griffiths
Programming C# 12

Programming C# 12

Ian Griffiths

Publisher Resources

ISBN: 9781098117801Errata PageSupplemental Content