Question

I need to return a collection of items with the push-model (as opposed to pull, like IEnumerable). However, I'm not sure if I should use IObservable from reactive extensions or ISourceBlock from TPL Dataflow.

They seem very similar, under what circumstances should one choose one over the other?

Was it helpful?

Solution

Basically, I think the answer comes down to how are you going to use the results. If you want to process them using TPL Dataflow, return ISourceBlock<T>. If you're going to process them using Rx, use IObservable<T>.

If you don't know, I think it's better to return ISourceBlock<T>, because it can be easily converted to IObservable<T>.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top