on-internet
← Community

Emulate yield return for IObservable

Stack Overflow ·

When I don't know how to do generate some enumerable using LINQ, I just create my own extension method and use the yield keyword. This gives me a closure where I can store things such as a counter or some other aggregate values. In an IObservable I don't know if there is a built-in way to do this. I recently wanted to generate an observable which, given another IObservable<string>, ignores everything until a starting value (say "start") appears in the source, and then starts ignoring everything until the source yields an ending value (say "end"). So if, for instance my source was {"1", "start"

Comments

Sign in or sign up to comment and upvote.

No comments yet.