I created a SlidingWindow operator for reactive extensions because I want to easily monitor things like rolling averages, etc. As a simple example, I want to s
Using your original test, with an argument of 3 for count, this gives the desired results:
public static IObservable> SlidingWindow(
this IObservable source, int count)
{
return source.Buffer(count, 1)
.Where(list => list.Count == count);
}
Testing like this:
var source = Observable.Range(1, 5);
var query = source.SlidingWindow(3);
using (query.Subscribe(i => Console.WriteLine(string.Join(",", i))))
{
}
Output:
1,2,3
2,3,4
3,4,5