Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good example of Reactive Extensions Use [closed]

I understand the basics of Rx. Where I'm struggling is how you would actually use this beyond academic examples? What are some common, simple real-world scenarios where Rx is a much better solution than what we have today in .NET?

like image 944
Keith Hill Avatar asked Mar 31 '10 05:03

Keith Hill


People also ask

What is the purpose of reactive extension?

It calculates the total and pushes the result to stream c. If, for example, c is also connected to some other stream from some other operation (e.g. multiplier), in that case, even multiplier operation would get invoked automatically. Thus, we can see that, in reactive programming, we do not invoke functions.

What is Rx in C#?

Basically, Rx is a library for composing asynchronous and event-based programs using observable collections. This is very useful in the case wherein you are pulling data asynchronously from different sources and then manipulating the same and finally printing the result.

What is Rx Net?

Rx.NET: (this repository) The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators.


2 Answers

For a bunch of good examples, see the 101 Rx Samples wiki

like image 156
sblom Avatar answered Oct 26 '22 15:10

sblom


Rx allows you to write code that orchestrates concurrent events together. If you've ever used the TPL (i.e. Task), then had to do convoluted backflips to try to ContinueWith or WaitAll on the right things, Rx is for you.

For example, the workflow of "For each item in this array, call a web service, and when all of those requests come back, do something else. If any one of them fail, fail the whole thing".

Disclosure, Shameless plug ahead: The book that Jesse Liberty and I wrote about Rx was designed to solve exactly this question, "How do I use Rx in my day-to-day work?"; "What can I do with this?"

like image 42
Ana Betts Avatar answered Oct 26 '22 17:10

Ana Betts