8. Pulling data from a source int[] numbers=newint[] { 20, 31, 5, 16, 22}; IEnumerable<int>numbersSmallerThan20=numbers.Where(number=>number<20); 5, 16, break IEnumerable<int>NaturalNumbers() { intnumber=0; while(true) { yieldreturnnumber; number++; } } 0,1,2,3,4,5,6…
9. Reactive programming button.MouseMove+= (s, args) => Debug.WriteLine("You moved the mouse to {0}", args.GetPosition(button)); “You moved the mouse to 20,3” “You moved the mouse to 33,12” “You moved the mouse to 44,18” DownloadFile("http://www.jeffwilcox.com", (byteArray) => Debug.WriteLine("This file is {0} bytes long.", byteArray.Length); “This file is 12323 bytes long.”
10. Events and Callbacks are Sequences of Data! newMouseEventArgs(newPoint(20,3)), newMouseEventArgs(newPoint(33,12)), newMouseEventArgs(newPoint(44,18))… newbyte[]{23,211,33,23…}, break
12. Unit testing slui with rx Rating rating = new Rating(); IObservable<Unit> test = 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));
13.
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. First encounters with Reactive Extensions -http://msmvps.com/blogs/jon_skeet/archive/2010/01/16/first-encounters-with-reactive-extensions.aspx
16. LINQ to Rx: second impressions - http://msmvps.com/blogs/jon_skeet/archive/2010/01/19/linq-to-rx-second-impressions.aspx
17.
18. Rx for .NET Framework 4.0 - http://go.microsoft.com/fwlink/?LinkId=182997