Skip to content

Instantly share code, notes, and snippets.

@cburgdorf
Created November 10, 2011 19:29
Show Gist options
  • Save cburgdorf/1355881 to your computer and use it in GitHub Desktop.
Save cburgdorf/1355881 to your computer and use it in GitHub Desktop.
Why is this just printing 1?
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