Reactive Extensions for .NET, Rx<br />One of the most powerful extensions for .NET Framework<br />IevgenOlieniev<br />.Net...
The first appearance in the world:<br />July 2009<br />Unit Tests<br />
Current situation:<br />Includes libraries:<br /><ul><li>System.CoreEx.dll
System.Interactive.dll
System.Observable.dll
System.Reactive.dll
System.Reactive.Testing.dll</li></li></ul><li>The iteratorpatern<br />
Pulling data from a source<br />int[] numbers=newint[] { 20, 31, 5, 16, 22};<br />IEnumerable<int>numbersSmallerThan20=num...
Reactive programming<br />button.MouseMove+= (s, args) =><br />Debug.WriteLine("You moved the mouse to {0}", <br />args.Ge...
Events and Callbacks are<br />Sequences of Data!<br />newMouseEventArgs(newPoint(20,3)),<br />	newMouseEventArgs(newPoint(...
A new look atthe observer pattern<br />
Unit testing slui with rx<br />Rating rating = new Rating();<br />IObservable<Unit> test =<br />ObservableExtensions      ...
Upcoming SlideShare
Loading in...5
×

Rx for .net

1,084

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,084
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Some notes
  • Some notes
  • Some notes
  • Some notes
  • After this slide should be an example of working code using VS 2010
  • Some notes
  • Rx for .net

    1. 1. Reactive Extensions for .NET, Rx<br />One of the most powerful extensions for .NET Framework<br />IevgenOlieniev<br />.Net Senior Developer<br />Soft Serve<br />
    2. 2. The first appearance in the world:<br />July 2009<br />Unit Tests<br />
    3. 3. Current situation:<br />Includes libraries:<br /><ul><li>System.CoreEx.dll
    4. 4. System.Interactive.dll
    5. 5. System.Observable.dll
    6. 6. System.Reactive.dll
    7. 7. System.Reactive.Testing.dll</li></li></ul><li>The iteratorpatern<br />
    8. 8. Pulling data from a source<br />int[] numbers=newint[] { 20, 31, 5, 16, 22};<br />IEnumerable<int>numbersSmallerThan20=numbers.Where(number=>number<20);<br />5, 16, break<br />IEnumerable<int>NaturalNumbers()<br />{<br />intnumber=0;<br /> while(true)<br /> {<br /> yieldreturnnumber;<br /> number++;<br /> }<br />}<br />0,1,2,3,4,5,6…<br />
    9. 9. Reactive programming<br />button.MouseMove+= (s, args) =><br />Debug.WriteLine("You moved the mouse to {0}", <br />args.GetPosition(button));<br />“You moved the mouse to 20,3”<br />“You moved the mouse to 33,12”<br />“You moved the mouse to 44,18”<br />DownloadFile("http://www.jeffwilcox.com", (byteArray) =><br />Debug.WriteLine("This file is {0} bytes long.",<br />byteArray.Length);<br />“This file is 12323 bytes long.”<br />
    10. 10. Events and Callbacks are<br />Sequences of Data!<br />newMouseEventArgs(newPoint(20,3)),<br /> newMouseEventArgs(newPoint(33,12)),<br /> newMouseEventArgs(newPoint(44,18))…<br />newbyte[]{23,211,33,23…}, break<br />
    11. 11. A new look atthe observer pattern<br />
    12. 12. Unit testing slui with rx<br />Rating rating = new Rating();<br />IObservable<Unit> test =<br />ObservableExtensions      .DoAsync(() => TestPanel.Children.Add(rating)) // add a control to a panel      .WaitFor(TestPanel.GetLayoutUpdated()) // listen to LayoutUpdated event      .DoAsync(() => rating.Value = 1.0) // set a property      .WaitFor(          rating.GetActualValueChanged() // listen to ActualValueChanged event            .SkipWhile(actualValueChangedEvent =>               actualValueChangedEvent.EventArgs.NewValue != rating.Value))       .Assert(() => rating.GetRatingItems().Last().ActualValue == 1.0); // Assert// run the test and clean up at the endtest.Subscribe(() => TestPanel.Children.Remove(rating));<br />
    13. 13. Info References:<br /><ul><li>Introducing Rx (Linq to Events) - http://themechanicalbride.blogspot.com/2009/07/introducing-rx-linq-to-events.html
    14. 14. A Brief Introduction to the Reactive Extensions for .NET, Rx - http://blogs.msdn.com/b/wesdyer/archive/2009/11/18/a-brief-introduction-to-the-reactive-extensions-for-net-rx.aspx
    15. 15. First encounters with Reactive Extensions -http://msmvps.com/blogs/jon_skeet/archive/2010/01/16/first-encounters-with-reactive-extensions.aspx
    16. 16. LINQ to Rx: second impressions - http://msmvps.com/blogs/jon_skeet/archive/2010/01/19/linq-to-rx-second-impressions.aspx
    17. 17. DevLabs: Reactive Extensions for .NET (Rx) -http://rxwiki.wikidot.com/</li></li></ul><li>download References:<br /><ul><li>Rx for Silverlight 4 - http://go.microsoft.com/fwlink/?LinkId=182998
    18. 18. Rx for .NET Framework 4.0 - http://go.microsoft.com/fwlink/?LinkId=182997
    19. 19. Rx for JavaScript -http://msdn.microsoft.com/devlabs/ff628422
    20. 20. Rx for .NET Framework 3.5 SP1 -http://go.microsoft.com/fwlink/?LinkId=182996</li></li></ul><li>Thank You!<br />
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×