SlideShare a Scribd company logo
1 of 19
Reactive Extensions
for .NET
Andrei Marukovich
contact@lunarfrog.com
twitter: @amarukovich
Rx is a library for composing
asynchronous and event-based
programs using observable sequences
and LINQ-style query operators.
Rx = Observables + LINQ + Schedulers
Observables
• IObservable<T>
• IObserver<T>
Enumerables
interface IEnumerable<out T>
{
IEnumerator<T> GetEnumerator();
}
interface IEnumerator<out T> : IDisposable
{
T Current { get; }
bool MoveNext();
void Reset();
}
Pull and Push
Consumer
Pull
Any new data?

IEnumerable

•
•
•
•

Sensors
UI events
Web services
Social media

Source

IObservable

Push
New data available!
Observables
interface IObservable<out T>
{
IDisposable Subscribe(IObserver<T> observer);
}
interface IObserver<out T>
{
void OnNext(T value);
void OnError(Exception error);
void OnCompleted();
}
Using observables
IObservable

IObserver

Subscribe

OnNext

OnNext

OnComplete
Contract
OnNext* [OnComplete | OnError]
1

2

1

3
2

1

2

1

2 3

4

3

3

4
4

5

6
Demo: Observable sequences
• Subject<T>
• Observable
• Never, Empty, Return, Throw, Create
• Range, Generate, Repeat
• Interval, Timer
LINQ
Filtering
• Where, Distinct, Skip(While|Last|Until), Take

Inspection
• Any, All

Aggregation and transformation
• Count, Min, Max, Average, Select
Demo: LINQ
• Common LINQ operators
• Combining sequences
• Pairing
• Sequentially
• Concurrently
Rx bridges
• Observable.FromAsync()
• Observable.FromEvent()
• Observable.FromEventPattern()
Demo: LINQ to events
• Time shifting
• Throttle
• Sample
• Buffer
• Delay
Concurrency
SubscribeOn
• Invocation of the subscription

ObserveOn
• Observing of notifications
Demo: Concurrency
• Schedulers
Schedulers
• ImmediateScheduler

• CurrentThreadScheduler
• DispatcherScheduler
• EventLoopScheduler
• NewThreadScheduler
• Thread/Task Pool

• TestScheduler
Flavors of Rx
.NET
• WinForms, WPF, Silverlight
• Windows Phone, WinRT
• ASP
.NET

Beyond .NET
• RxJS, RxCpp
• RxPy, Rx.rb
Resources
• http://rx.codeplex.com/
• http://bit.ly/Rx-Home
Thank you!

Andrei Marukovich
contact@lunarfrog.com
twitter: @amarukovich

More Related Content

What's hot

Test presentation impress
Test presentation impressTest presentation impress
Test presentation impress
shoesh1neboy
 
ELK Syslog server - Kibana
ELK Syslog server - KibanaELK Syslog server - Kibana
ELK Syslog server - Kibana
Eric van Dijken
 

What's hot (20)

Functional Reactive Angular 2
Functional Reactive Angular 2 Functional Reactive Angular 2
Functional Reactive Angular 2
 
3 Презентация Kotlin - why not?
3 Презентация Kotlin - why not?3 Презентация Kotlin - why not?
3 Презентация Kotlin - why not?
 
Oot practical
Oot practicalOot practical
Oot practical
 
Últimas atualizações de produtividade no Visual Studio 2017​
Últimas atualizações de produtividade no Visual Studio 2017​Últimas atualizações de produtividade no Visual Studio 2017​
Últimas atualizações de produtividade no Visual Studio 2017​
 
Keynote: Stephan Ewen - Stream Processing as a Foundational Paradigm and Apac...
Keynote: Stephan Ewen - Stream Processing as a Foundational Paradigm and Apac...Keynote: Stephan Ewen - Stream Processing as a Foundational Paradigm and Apac...
Keynote: Stephan Ewen - Stream Processing as a Foundational Paradigm and Apac...
 
My Gentle Introduction to RxJS
My Gentle Introduction to RxJSMy Gentle Introduction to RxJS
My Gentle Introduction to RxJS
 
Spark as a distributed Scala
Spark as a distributed ScalaSpark as a distributed Scala
Spark as a distributed Scala
 
Test presentation impress
Test presentation impressTest presentation impress
Test presentation impress
 
ELK Syslog server - Kibana
ELK Syslog server - KibanaELK Syslog server - Kibana
ELK Syslog server - Kibana
 
Example
ExampleExample
Example
 
Correctness and Performance of Apache Spark SQL
Correctness and Performance of Apache Spark SQLCorrectness and Performance of Apache Spark SQL
Correctness and Performance of Apache Spark SQL
 
Adding A Dash In jQuery:
Adding A Dash In jQuery:Adding A Dash In jQuery:
Adding A Dash In jQuery:
 
Sync with async
Sync with  asyncSync with  async
Sync with async
 
24 Weeks at AdroitLogic - My Internship Experience
24 Weeks at AdroitLogic - My Internship Experience24 Weeks at AdroitLogic - My Internship Experience
24 Weeks at AdroitLogic - My Internship Experience
 
Przywitaj się z reactive extensions
Przywitaj się z reactive extensionsPrzywitaj się z reactive extensions
Przywitaj się z reactive extensions
 
Make your programs Free
Make your programs FreeMake your programs Free
Make your programs Free
 
Introduction To Functional Reactive Programming Poznan
Introduction To Functional Reactive Programming PoznanIntroduction To Functional Reactive Programming Poznan
Introduction To Functional Reactive Programming Poznan
 
Flink Forward Berlin 2017: Francesco Versaci - Integrating Flink and Kafka in...
Flink Forward Berlin 2017: Francesco Versaci - Integrating Flink and Kafka in...Flink Forward Berlin 2017: Francesco Versaci - Integrating Flink and Kafka in...
Flink Forward Berlin 2017: Francesco Versaci - Integrating Flink and Kafka in...
 
Outsmarting the smart meter (Jfokus 2017)
Outsmarting the smart meter (Jfokus 2017)Outsmarting the smart meter (Jfokus 2017)
Outsmarting the smart meter (Jfokus 2017)
 
I²: Interactive Real-Time Visualization for Streaming Data with Apache Flink ...
I²: Interactive Real-Time Visualization for Streaming Data with Apache Flink ...I²: Interactive Real-Time Visualization for Streaming Data with Apache Flink ...
I²: Interactive Real-Time Visualization for Streaming Data with Apache Flink ...
 

Similar to Reactive Extensions for .NET

Reactive Extensions, Rx
Reactive Extensions, RxReactive Extensions, Rx
Reactive Extensions, Rx
Dima Pasko
 
Reactive Extensions
Reactive ExtensionsReactive Extensions
Reactive Extensions
Kiev ALT.NET
 
Language Integrated Query - LINQ
Language Integrated Query - LINQLanguage Integrated Query - LINQ
Language Integrated Query - LINQ
Doncho Minkov
 
Rx: Curing Your Asynchronous Programming Blues | QCon London
Rx: Curing Your Asynchronous Programming Blues |  QCon LondonRx: Curing Your Asynchronous Programming Blues |  QCon London
Rx: Curing Your Asynchronous Programming Blues | QCon London
Jiby John
 

Similar to Reactive Extensions for .NET (20)

Link quries
Link quriesLink quries
Link quries
 
Reactive programming
Reactive programmingReactive programming
Reactive programming
 
Reative UI
Reative UIReative UI
Reative UI
 
Intro to Akka Streams
Intro to Akka StreamsIntro to Akka Streams
Intro to Akka Streams
 
响应式编程及框架
响应式编程及框架响应式编程及框架
响应式编程及框架
 
Reactive Extensions, Rx
Reactive Extensions, RxReactive Extensions, Rx
Reactive Extensions, Rx
 
Reactive Spring 5
Reactive Spring 5Reactive Spring 5
Reactive Spring 5
 
Reactive Extensions
Reactive ExtensionsReactive Extensions
Reactive Extensions
 
RxJava - introduction & design
RxJava - introduction & designRxJava - introduction & design
RxJava - introduction & design
 
Streams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to RxStreams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to Rx
 
LINQ.pptx
LINQ.pptxLINQ.pptx
LINQ.pptx
 
Language Integrated Query - LINQ
Language Integrated Query - LINQLanguage Integrated Query - LINQ
Language Integrated Query - LINQ
 
Reactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NETReactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NET
 
Streaming SQL to unify batch and stream processing: Theory and practice with ...
Streaming SQL to unify batch and stream processing: Theory and practice with ...Streaming SQL to unify batch and stream processing: Theory and practice with ...
Streaming SQL to unify batch and stream processing: Theory and practice with ...
 
Reactive Extensions
Reactive ExtensionsReactive Extensions
Reactive Extensions
 
Rx: Curing Your Asynchronous Programming Blues | QCon London
Rx: Curing Your Asynchronous Programming Blues |  QCon LondonRx: Curing Your Asynchronous Programming Blues |  QCon London
Rx: Curing Your Asynchronous Programming Blues | QCon London
 
How to Think in RxJava Before Reacting
How to Think in RxJava Before ReactingHow to Think in RxJava Before Reacting
How to Think in RxJava Before Reacting
 
Migration Objective-C to Swift
Migration Objective-C to SwiftMigration Objective-C to Swift
Migration Objective-C to Swift
 
LINQ-Introduction.ppt
LINQ-Introduction.pptLINQ-Introduction.ppt
LINQ-Introduction.ppt
 
Infinum iOS Talks #4 - Making our VIPER more reactive
Infinum iOS Talks #4 - Making our VIPER more reactiveInfinum iOS Talks #4 - Making our VIPER more reactive
Infinum iOS Talks #4 - Making our VIPER more reactive
 

More from Andrei Marukovich

More from Andrei Marukovich (8)

Modern .NET Ecosystem
Modern .NET EcosystemModern .NET Ecosystem
Modern .NET Ecosystem
 
Using NuGet libraries in your application
Using NuGet libraries in your applicationUsing NuGet libraries in your application
Using NuGet libraries in your application
 
C# code sharing across the platforms
C# code sharing across the platformsC# code sharing across the platforms
C# code sharing across the platforms
 
Open Source Libraries for.NET developers
Open Source Libraries for.NET developersOpen Source Libraries for.NET developers
Open Source Libraries for.NET developers
 
Deceptive simplicity of async and await
Deceptive simplicity of async and awaitDeceptive simplicity of async and await
Deceptive simplicity of async and await
 
All about data persistence in Windows 8
All about data persistence in Windows 8All about data persistence in Windows 8
All about data persistence in Windows 8
 
ATDD in practice
ATDD in practiceATDD in practice
ATDD in practice
 
A Developer's View of Windows 8
A Developer's View of Windows 8A Developer's View of Windows 8
A Developer's View of Windows 8
 

Recently uploaded

VADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call meVADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call me
shivanisharma5244
 
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
baharayali
 
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
baharayali
 
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Amil Baba Naveed Bangali
 
Amil baba, Kala ilam expert in Multan and Black magic specialist in Sindh and...
Amil baba, Kala ilam expert in Multan and Black magic specialist in Sindh and...Amil baba, Kala ilam expert in Multan and Black magic specialist in Sindh and...
Amil baba, Kala ilam expert in Multan and Black magic specialist in Sindh and...
baharayali
 
Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
baharayali
 
-Developing-the-10-Paramis-in-a-Vipassana-Meditation.ppt
-Developing-the-10-Paramis-in-a-Vipassana-Meditation.ppt-Developing-the-10-Paramis-in-a-Vipassana-Meditation.ppt
-Developing-the-10-Paramis-in-a-Vipassana-Meditation.ppt
BonnieDuran1
 

Recently uploaded (20)

St John's Church Parish Diary for May 2024
St John's Church Parish Diary for May 2024St John's Church Parish Diary for May 2024
St John's Church Parish Diary for May 2024
 
VADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call meVADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call me
 
From The Heart v8.pdf xxxxxxxxxxxxxxxxxxx
From The Heart v8.pdf xxxxxxxxxxxxxxxxxxxFrom The Heart v8.pdf xxxxxxxxxxxxxxxxxxx
From The Heart v8.pdf xxxxxxxxxxxxxxxxxxx
 
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
 
May 2024 Calendar of Events for Hope Lutheran Church
May 2024 Calendar of Events for Hope Lutheran ChurchMay 2024 Calendar of Events for Hope Lutheran Church
May 2024 Calendar of Events for Hope Lutheran Church
 
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
 
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...
 
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
 
Elite Class ➥8448380779▻ Call Girls In Naraina Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Naraina Delhi NCRElite Class ➥8448380779▻ Call Girls In Naraina Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Naraina Delhi NCR
 
Genesis 1:8 || Meditate the Scripture daily verse by verse
Genesis 1:8  ||  Meditate the Scripture daily verse by verseGenesis 1:8  ||  Meditate the Scripture daily verse by verse
Genesis 1:8 || Meditate the Scripture daily verse by verse
 
Amil baba, Kala ilam expert in Multan and Black magic specialist in Sindh and...
Amil baba, Kala ilam expert in Multan and Black magic specialist in Sindh and...Amil baba, Kala ilam expert in Multan and Black magic specialist in Sindh and...
Amil baba, Kala ilam expert in Multan and Black magic specialist in Sindh and...
 
Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
 
-Developing-the-10-Paramis-in-a-Vipassana-Meditation.ppt
-Developing-the-10-Paramis-in-a-Vipassana-Meditation.ppt-Developing-the-10-Paramis-in-a-Vipassana-Meditation.ppt
-Developing-the-10-Paramis-in-a-Vipassana-Meditation.ppt
 
Deerfoot Church of Christ Bulletin 5 5 24
Deerfoot Church of Christ Bulletin 5 5 24Deerfoot Church of Christ Bulletin 5 5 24
Deerfoot Church of Christ Bulletin 5 5 24
 
Hire Best Next Js Developer For Your Project
Hire Best Next Js Developer For Your ProjectHire Best Next Js Developer For Your Project
Hire Best Next Js Developer For Your Project
 
English - The Forgotten Books of Eden.pdf
English - The Forgotten Books of Eden.pdfEnglish - The Forgotten Books of Eden.pdf
English - The Forgotten Books of Eden.pdf
 
Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24
 
Genesis 1:10 || Meditate the Scripture daily verse by verse
Genesis 1:10  ||  Meditate the Scripture daily verse by verseGenesis 1:10  ||  Meditate the Scripture daily verse by verse
Genesis 1:10 || Meditate the Scripture daily verse by verse
 
St. Louise de Marillac and Poor Children
St. Louise de Marillac and Poor ChildrenSt. Louise de Marillac and Poor Children
St. Louise de Marillac and Poor Children
 
Legends of the Light v2.pdf xxxxxxxxxxxxx
Legends of the Light v2.pdf xxxxxxxxxxxxxLegends of the Light v2.pdf xxxxxxxxxxxxx
Legends of the Light v2.pdf xxxxxxxxxxxxx
 

Reactive Extensions for .NET