SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

Tendances (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 ...
 

Similaire à 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
 

Similaire à 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
 

Plus de Andrei Marukovich

Plus de 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
 

Dernier

Russian Call Girls Rohini Sector 39 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
Russian Call Girls Rohini Sector 39 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...Russian Call Girls Rohini Sector 39 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
Russian Call Girls Rohini Sector 39 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
Rohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
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, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
baharayali
 
VIP Call Girls Service mohali 7001035870 Enjoy Call Girls With Our Escorts
VIP Call Girls Service mohali 7001035870 Enjoy Call Girls With Our EscortsVIP Call Girls Service mohali 7001035870 Enjoy Call Girls With Our Escorts
VIP Call Girls Service mohali 7001035870 Enjoy Call Girls With Our Escorts
sonatiwari757
 
Call Girls in majnu ka tila Delhi 8264348440 ✅ call girls ❤️
Call Girls in majnu ka tila Delhi 8264348440 ✅ call girls ❤️Call Girls in majnu ka tila Delhi 8264348440 ✅ call girls ❤️
Call Girls in majnu ka tila Delhi 8264348440 ✅ call girls ❤️
soniya singh
 

Dernier (20)

Jude: The Acts of the Apostates (Jude vv.1-4).pptx
Jude: The Acts of the Apostates (Jude vv.1-4).pptxJude: The Acts of the Apostates (Jude vv.1-4).pptx
Jude: The Acts of the Apostates (Jude vv.1-4).pptx
 
NoHo First Good News online newsletter May 2024
NoHo First Good News online newsletter May 2024NoHo First Good News online newsletter May 2024
NoHo First Good News online newsletter May 2024
 
Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...
Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...
Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...
 
Russian Call Girls Rohini Sector 39 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
Russian Call Girls Rohini Sector 39 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...Russian Call Girls Rohini Sector 39 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
Russian Call Girls Rohini Sector 39 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
 
Rohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 21 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Famous No1 Amil baba in UK/Australia, Canada, Germany Amil baba Kala jadu
Famous No1 Amil baba in UK/Australia, Canada, Germany Amil baba Kala jaduFamous No1 Amil baba in UK/Australia, Canada, Germany Amil baba Kala jadu
Famous No1 Amil baba in UK/Australia, Canada, Germany Amil baba Kala jadu
 
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
 
English - The Story of Ahikar, Grand Vizier of Assyria.pdf
English - The Story of Ahikar, Grand Vizier of Assyria.pdfEnglish - The Story of Ahikar, Grand Vizier of Assyria.pdf
English - The Story of Ahikar, Grand Vizier of Assyria.pdf
 
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...
 
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
 
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
 
Genesis 1:7 || Meditate the Scripture daily verse by verse
Genesis 1:7  ||  Meditate the Scripture daily verse by verseGenesis 1:7  ||  Meditate the Scripture daily verse by verse
Genesis 1:7 || Meditate the Scripture daily verse by verse
 
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
 
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
 
VIP Call Girls Service mohali 7001035870 Enjoy Call Girls With Our Escorts
VIP Call Girls Service mohali 7001035870 Enjoy Call Girls With Our EscortsVIP Call Girls Service mohali 7001035870 Enjoy Call Girls With Our Escorts
VIP Call Girls Service mohali 7001035870 Enjoy Call Girls With Our Escorts
 
+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...
 
Call Girls in majnu ka tila Delhi 8264348440 ✅ call girls ❤️
Call Girls in majnu ka tila Delhi 8264348440 ✅ call girls ❤️Call Girls in majnu ka tila Delhi 8264348440 ✅ call girls ❤️
Call Girls in majnu ka tila Delhi 8264348440 ✅ call girls ❤️
 
Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...
Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...
Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...
 
Sabbath Cooking seventh-day sabbath.docx
Sabbath Cooking seventh-day sabbath.docxSabbath Cooking seventh-day sabbath.docx
Sabbath Cooking seventh-day sabbath.docx
 
Lesson 4 - How to Conduct Yourself on a Walk.pptx
Lesson 4 - How to Conduct Yourself on a Walk.pptxLesson 4 - How to Conduct Yourself on a Walk.pptx
Lesson 4 - How to Conduct Yourself on a Walk.pptx
 

Reactive Extensions for .NET