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

定义

从指定的数组索引开始,将数组段的元素复制到一个数组中。Copies the elements of the array segment to an array, starting at the specified array index.

 virtual void System.Collections.Generic.ICollection<T>.CopyTo(cli::array <T> ^ array, int arrayIndex) = System::Collections::Generic::ICollection<T>::CopyTo;
void ICollection<T>.CopyTo (T[] array, int arrayIndex);
Sub CopyTo (array As T(), arrayIndex As Integer) Implements ICollection(Of T).CopyTo

参数

array
T[]

作为从数组段复制的元素的目标数组的一维数组。The one-dimensional array that is the destination of the elements copied from the array segment. 该数组的索引必须从零开始。The array must have zero-based indexing.

arrayIndex
Int32

array 中从零开始的索引,从此处开始复制。The zero-based index in array at which copying begins.

实现

异常

arraynullarray is null.

arrayIndex 小于 0。arrayIndex is less than 0.

array 是多维的。array is multidimensional.

-or- 源数组段中的元素数大于从 arrayIndex 到目标 array 的末尾的可用空间。The number of elements in the source array segment is greater than the available space from arrayIndex to the end of the destination array.

-or- 无法自动将类型 T 转换为目标 array 的类型。Type T cannot be cast automatically to the type of the destination array.

ArraySegment<T> 实例的基础数组为 nullThe underlying array for this ArraySegment<T> instance is null.

注解

此成员是显式接口成员的实现。This member is an explicit interface member implementation. 它只能在 ArraySegment<T> 实例被强制转换为 ICollection<T> 接口时使用。It can be used only when the ArraySegment<T> instance is cast to an ICollection<T> interface.

适用于