I have a class that goes to get objects from a web service. My consumption of these objects is not order dependent so I issue my web requests in parallel and am adding the results to a ConcurrentQueue
.
At the same time, as the requests are being made, we can process the responses.
So I would like to be able to iterate over the contents of the ConcurrentQueue
while my items are being added to it.
How can I have one class fill up the queue and the other class empty it. It will almost certainly be emptied faster than it is filler, so I can't just enumerate it without having a yield
because the collection will be empty and won't wait.