ConcurrentQueue<T>.ICollection.CopyTo(Array, Int32) ConcurrentQueue<T>.ICollection.CopyTo(Array, Int32) Method

定義

從特定的 ICollection 索引開始,將 Array 的項目複製到 ArrayCopies the elements of the ICollection to an Array, starting at a particular Array index.

 virtual void System.Collections.ICollection.CopyTo(Array ^ array, int index) = System::Collections::ICollection::CopyTo;
void ICollection.CopyTo (Array array, int index);

參數

array
Array Array

一維 Array,是從 ConcurrentBag<T> 複製過來的項目之目的端。The one-dimensional Array that is the destination of the elements copied from the ConcurrentBag<T>. Array 必須有以零為起始的索引。The Array must have zero-based indexing.

index
Int32 Int32

array 中以零起始的索引,即開始複製的位置。The zero-based index in array at which copying begins.

實作

例外狀況

array 是 null 參考 (在 Visual Basic 中為 Nothing)。array is a null reference (Nothing in Visual Basic).

index 小於零。index is less than zero.

array 是多維的。array is multidimensional. array 沒有以零起始的索引。-or- array does not have zero-based indexing. index 是等於或大於 array 的長度,或者來源 ICollection 中的項目數大於從 index 到目的地 array 結尾的可用空間。-or- index is equal to or greater than the length of the array -or- The number of elements in the source ICollection is greater than the available space from index to the end of the destination array. 或來源 ICollection 的型別無法自動轉換為目的 array 的型別。-or- The type of the source ICollection cannot be cast automatically to the type of the destination array.

適用於

另請參閱