Dad, self-employed, problem solver at heart, async all the way. Formerly a principal software engineer at Nuance Communications. Occasionally I tweet, blog and answer my own StackOverflow questions.
It's a good question. In theory, I imagine it could be any code that needs to process a sequence of events, e.g., collecting data from an IoT device or processing stock market updates. For use cases like these, we would probably want to use a bounded channel or something like BufferBlock<T> as event buffer on the producer side, to prevent the queue from growing indefinitely.
In practice though, I myself so far only have used that for automated coded UI testing of my side project DevComrade with asynchronous coroutines approach. In that case, the consumer of IAsyncEnumerable stream is essentially a pseudo-linear script (thanks to async/await) that just expects UI events in a particular order. I.e., it doesn't even need an await foreach loop. I'll go into more details about that with another blog post.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Do you have any practical examples where someone would want to do this?
It's a good question. In theory, I imagine it could be any code that needs to process a sequence of events, e.g., collecting data from an IoT device or processing stock market updates. For use cases like these, we would probably want to use a bounded channel or something like
BufferBlock<T>
as event buffer on the producer side, to prevent the queue from growing indefinitely.In practice though, I myself so far only have used that for automated coded UI testing of my side project
DevComrade
with asynchronous coroutines approach. In that case, the consumer ofIAsyncEnumerable
stream is essentially a pseudo-linear script (thanks to async/await) that just expects UI events in a particular order. I.e., it doesn't even need anawait foreach
loop. I'll go into more details about that with another blog post.