Say for example I have an enumerable
dim e = Enumerable.Range(0, 1024)
I\'d like to be able to do
dim o = e.ToObservable(Timesp
You'd need something to schedule notifying observers with each value taken from the Enumerable. You can use the recursive Schedule overload on an Rx scheduler.
Public Shared Function Schedule ( _
scheduler As IScheduler, _
dueTime As TimeSpan, _
action As Action(Of Action(Of TimeSpan)) _
) As IDisposable
On each scheduled invocation, simply call enumerator.MoveNext()
, and call OnNext(enumerator.Current)
, and finally OnCompleted
when MoveNext()
returns false. This is pretty much the bare-bones way of doing it.
An alternative was to express your requirement is to restate it as "for a sequence, have a minimum interval between each value".
See this answer. The test case resembles your original question.