Closed tesfabpel closed 5 years ago
I have no experience with this. It looks like to "support it", we just need to implement IProducerConsumerCollection<T>
. Is that correct?
It seems so since the constructor of Blocking Collection takes an instance of an object implementing that interface. Sadly, I don't know how to implement it myself.
I attempted to implement this tonight. Unfortunately, it would require upgrading from .Net Standard 1.0 to 1.1, which would alienate some users.
Additionally, the TryAdd()
method causes problems - it only supports adding a single value, without a priority, which doesn't work for a priority queue. I tried using KeyValuePair
or Tuple
instead, but the former isn't available in UWP, and the latter isn't available prior to .Net 4.0. I also considered simply marking TryAdd()
as not implemented, but that means items can no longer be added through the BlockingCollection
, which defeats the use-case for this suggestion.
So unfortunately, I'm going to have to close this as "will not implement" :(
Please add support for BlockingCollection.
BlockingCollection is very useful in multi-threaded code since it allows you to do something like this:
Thanks.