BlockingCollection<T> 构造函数

定义

初始化没有上限的 BlockingCollection<T> 类的新实例。

重载

名称 说明
BlockingCollection<T>()

初始化没有上限的 BlockingCollection<T> 类的新实例。

BlockingCollection<T>(IProducerConsumerCollection<T>)

初始化没有上限的 BlockingCollection<T> 类的新实例,并使用所提供的 IProducerConsumerCollection<T> 作为其基础数据存储。

BlockingCollection<T>(Int32)

使用指定的上限初始化类的新实例 BlockingCollection<T>

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

使用指定的上限并使用提供的BlockingCollection<T>作为其基础数据存储的类的新实例IProducerConsumerCollection<T>进行初始化。

BlockingCollection<T>()

初始化没有上限的 BlockingCollection<T> 类的新实例。

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

注解

默认的基础集合是一个 ConcurrentQueue<T> 对象,该对象先提供先出(FIFO)行为。

另请参阅

适用于

BlockingCollection<T>(IProducerConsumerCollection<T>)

初始化没有上限的 BlockingCollection<T> 类的新实例,并使用所提供的 IProducerConsumerCollection<T> 作为其基础数据存储。

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

参数

collection
IProducerConsumerCollection<T>

要用作基础数据存储的集合。

例外

参数 collection 为 null。

另请参阅

适用于

BlockingCollection<T>(Int32)

使用指定的上限初始化类的新实例 BlockingCollection<T>

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)

参数

boundedCapacity
Int32

集合的边界大小。

例外

不是 boundedCapacity 正值。

注解

默认的基础集合是一个 ConcurrentQueue<T>

另请参阅

适用于

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

使用指定的上限并使用提供的BlockingCollection<T>作为其基础数据存储的类的新实例IProducerConsumerCollection<T>进行初始化。

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)

参数

collection
IProducerConsumerCollection<T>

要用作基础数据存储的集合。

boundedCapacity
Int32

集合的边界大小。

例外

参数 collection 为 null。

不是 boundedCapacity 正值。

提供的 collection 包含的值多于允许 boundedCapacity的值。

另请参阅

适用于