IProducerConsumerCollection<T>.CopyTo(T[], Int32) 方法

定義

從指定的索引位置開始,將 IProducerConsumerCollection<T> 的項目複製到 Array

public:
 void CopyTo(cli::array <T> ^ array, int index);
public void CopyTo (T[] array, int index);
abstract member CopyTo : 'T[] * int -> unit
Public Sub CopyTo (array As T(), index As Integer)

參數

array
T[]

一維 Array,是從 IProducerConsumerCollection<T> 複製過來的項目之目的端。

陣列必須有以零為起始的索引。

index
Int32

array 中以零起始的索引,即開始複製的位置。

例外狀況

array 是 null 參考 (在 Visual Basic 中為 Nothing)。

index 小於零。

index 等於或大於 array 的長度,或者,集合中項目的數量大於 index 到目的 array 結尾之間可用的空間。

備註

方法會提供基礎集合的快照集。 其他線程可以在複製之後立即新增或移除專案。

適用於

另請參閱