Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Reactive Programming for .NET Developers

You're reading from   Reactive Programming for .NET Developers Get up and running with reactive programming paradigms to build fast, concurrent, and powerful applications

Arrow left icon
Product type Paperback
Published in Jul 2016
Publisher Packt
ISBN-13 9781785882883
Length 276 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (10) Chapters Close

Preface 1. First Steps Toward Reactive Programming FREE CHAPTER 2. Reactive Programming with C# 3. Reactive Extension Programming 4. Observable Sequence Programming 5. Debugging Reactive Extensions 6. CLR Integration and Scheduling 7. Advanced Techniques 8. F# and Functional Reactive Programming 9. Advanced FRP and Best Practices

Filtering operators


Filtering operators act as the where operators of any LINQ query. They reduce, take, or peek a value (or multiple values) from a sequence when messages comply with a given filtering function.

Filter

The easiest filtering operator, filter, simply applies a filtering condition that allows or prevents messages from flowing throughout the newly created sequence. In Rx, the filter operator in made by using the Where extension method like in any other LINQ query.

A marble diagram showing a filter operation

Here's an example:

var s12 = new Subject<string>(); 
var filtered = s12.Where(x => x.Contains("e")); 
filtered.Subscribe(Console.WriteLine); 
s12.OnNext("Mr. Brown"); 
s12.OnNext("Mr. White"); 

Distinct

The distinct operator, similar to what happens in any SQL statement, creates a new sequence that prevents duplicated values from flowing out from the source sequence.

A marble diagram showing a distinct operation

Here's an example:

var s13 = new...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image