Using Reactive Extensions, I want to ignore messages coming from my event stream that occur while my Subscribe method is running. I.e. it sometimes takes me lon
With Rx 2.0 RC you can use Chunkify to get an IEnumerable of lists, each containing what was observed since the last MoveNext.
You can then use ToObservable to convert that back to an IObservable and only pay attention to the last entry in each non-empty list.
var messages = Observable.Interval(TimeSpan.FromMilliseconds(100));
messages.Chunkify()
.ToObservable(Scheduler.TaskPool)
.Where(list => list.Any())
.Select(list => list.Last())
.Subscribe(n =>
{
Thread.Sleep(TimeSpan.FromMilliseconds(250));
Console.WriteLine(n);
});