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


从特定的 ICollection 索引开始,将 Array 的元素复制到一个 Array 中。Copies 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);
abstract member System.Collections.ICollection.CopyTo : Array * int -> unit
override this.System.Collections.ICollection.CopyTo : Array * int -> unit
Sub CopyTo (array As Array, index As Integer) Implements ICollection.CopyTo



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

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.

Applies to

See also