|requires observer != null
|ensures result != null
public IDisposable Subscribe(IObserver<R> observer)
var generateState = new GenerateState()
condition = condition,
current = initial,
iterate = iterate,
observer = observer,
resultSelector = resultSelector,
return scheduler.Schedule(generateState, (state, self) =>
var result = state.resultSelector(state.current);
state.current = state.iterate(state.current);
This is what I came up with. It runs in AppDomainScheduler named scheduler. I want to build one of these schedulers to send remote entity framework queries around to different machines using WCF underneath. Is this possible? Any good getting started guides?
Also I run code contracts static checker and it complains that I might return null. I tried a few things like returning Disposable.Empty if IDisposable returned from Schedule function is null but that failed also. What is the correct behavior here to satisfy the contract. Thanks so much.