Created
November 10, 2011 19:29
-
-
Save cburgdorf/1355881 to your computer and use it in GitHub Desktop.
Why is this just printing 1?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var scheduler = new TestScheduler(); | |
var source = scheduler.CreateHotObservable( | |
new Recorded<Notification<int>>(600, Notification.CreateOnNext(1)), | |
new Recorded<Notification<int>>(1200, Notification.CreateOnNext(2)), | |
new Recorded<Notification<int>>(1600, Notification.CreateOnNext(3)), | |
new Recorded<Notification<int>>(2000, Notification.CreateOnNext(4)), | |
new Recorded<Notification<int>>(2400, Notification.CreateOnNext(5)), | |
new Recorded<Notification<int>>(3000, Notification.CreateOnNext(6)), | |
new Recorded<Notification<int>>(3500, Notification.CreateOnNext(7)) | |
); | |
var my = source | |
.Window(() => Observable.Timer(TimeSpan.FromMilliseconds(500))) | |
.SelectMany(x => x.Take(1)); | |
my.Subscribe(Console.WriteLine); | |
scheduler.AdvanceTo(3500); | |
Console.ReadLine(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment