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.

try example on .net fiddle

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

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -