BlockingCollection<T> Constructors

Definition

Overloads

BlockingCollection<T>()

Initializes a new instance of the BlockingCollection<T> class without an upper-bound.

BlockingCollection<T>(IProducerConsumerCollection<T>)

Initializes a new instance of the BlockingCollection<T> class without an upper-bound and using the provided IProducerConsumerCollection<T> as its underlying data store.

BlockingCollection<T>(Int32)

Initializes a new instance of the BlockingCollection<T> class with the specified upper-bound.

BlockingCollection<T>(IProducerConsumerCollection<T>, Int32)

Initializes a new instance of the BlockingCollection<T> class with the specified upper-bound and using the provided IProducerConsumerCollection<T> as its underlying data store.

BlockingCollection<T>()

Initializes a new instance of the BlockingCollection<T> class without an upper-bound.

public BlockingCollection ();

Remarks

The default underlying collection is a ConcurrentQueue<T> object, which provides first in, first out (FIFO) behavior.

BlockingCollection<T>(IProducerConsumerCollection<T>)

Initializes a new instance of the BlockingCollection<T> class without an upper-bound and using the provided IProducerConsumerCollection<T> as its underlying data store.

public BlockingCollection (System.Collections.Concurrent.IProducerConsumerCollection<T> collection);
Parameters
collection
IProducerConsumerCollection<T>

The collection to use as the underlying data store.

Exceptions

The collection argument is null.

BlockingCollection<T>(Int32)

Initializes a new instance of the BlockingCollection<T> class with the specified upper-bound.

public BlockingCollection (int boundedCapacity);
Parameters
boundedCapacity
Int32

The bounded size of the collection.

Exceptions

The boundedCapacity is not a positive value.

Remarks

The default underlying collection is a ConcurrentQueue<T>.

BlockingCollection<T>(IProducerConsumerCollection<T>, Int32)

Initializes a new instance of the BlockingCollection<T> class with the specified upper-bound and using the provided IProducerConsumerCollection<T> as its underlying data store.

public BlockingCollection (System.Collections.Concurrent.IProducerConsumerCollection<T> collection, int boundedCapacity);
Parameters
collection
IProducerConsumerCollection<T>

The collection to use as the underlying data store.

boundedCapacity
Int32

The bounded size of the collection.

Exceptions

The collection argument is null.

The boundedCapacity is not a positive value.

The supplied collection contains more values than is permitted by boundedCapacity.

Applies to