แก้ไข

แชร์ผ่าน


BlockingCollection<T> Constructors

Definition

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

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>()

Source:
BlockingCollection.cs
Source:
BlockingCollection.cs
Source:
BlockingCollection.cs

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

public:
 BlockingCollection();
public BlockingCollection ();
Public Sub New ()

Remarks

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

See also

Applies to

BlockingCollection<T>(IProducerConsumerCollection<T>)

Source:
BlockingCollection.cs
Source:
BlockingCollection.cs
Source:
BlockingCollection.cs

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);
public BlockingCollection (System.Collections.Concurrent.IProducerConsumerCollection<T> collection);
new System.Collections.Concurrent.BlockingCollection<'T> : System.Collections.Concurrent.IProducerConsumerCollection<'T> -> System.Collections.Concurrent.BlockingCollection<'T>
Public Sub New (collection As IProducerConsumerCollection(Of T))

Parameters

collection
IProducerConsumerCollection<T>

The collection to use as the underlying data store.

Exceptions

The collection argument is null.

See also

Applies to

BlockingCollection<T>(Int32)

Source:
BlockingCollection.cs
Source:
BlockingCollection.cs
Source:
BlockingCollection.cs

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

public:
 BlockingCollection(int boundedCapacity);
public BlockingCollection (int boundedCapacity);
new System.Collections.Concurrent.BlockingCollection<'T> : int -> System.Collections.Concurrent.BlockingCollection<'T>
Public Sub New (boundedCapacity As Integer)

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>.

See also

Applies to

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

Source:
BlockingCollection.cs
Source:
BlockingCollection.cs
Source:
BlockingCollection.cs

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);
public BlockingCollection (System.Collections.Concurrent.IProducerConsumerCollection<T> collection, int boundedCapacity);
new System.Collections.Concurrent.BlockingCollection<'T> : System.Collections.Concurrent.IProducerConsumerCollection<'T> * int -> System.Collections.Concurrent.BlockingCollection<'T>
Public Sub New (collection As IProducerConsumerCollection(Of T), boundedCapacity As Integer)

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.

See also

Applies to