c# - Default size of Blocking collection -
i wanted know default size of blocking collection. somehow program not able add elements in blocking collection.
the default size in code:
var collection = new blockingcollection<int>();
is has no upper limit, according documentation:
initializes new instance of blockingcollection class without upper-bound.
(my emphasis)
you can learn upper limit through .boundedcapacity property in case return -1
.
obviously unbounded blocking collection still has limit in number of elements can add in either underlying array or surrounding memory becomes full, not artificial limit imposed class itself.
if you're observing cannot add elements such collection, blocks case, not constructed in way.
instead constructed with specific limit , can still use .boundedcapacity
property shown above learn limit.
Comments
Post a Comment