ICollection<T>.CopyTo(T[], Int32) 方法
定义
从特定的 ICollection<T> 索引开始,将 Array 的元素复制到一个 Array 中。Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public:
void CopyTo(cli::array <T> ^ array, int arrayIndex);
public void CopyTo (T[] array, int arrayIndex);
abstract member CopyTo : 'T[] * int -> unit
Public Sub CopyTo (array As T(), arrayIndex As Integer)
参数
- array
- T[]
一维 Array,它是从 ICollection<T> 复制的元素的目标。The one-dimensional Array that is the destination of the elements copied from ICollection<T>. Array 必须具有从零开始的索引。The Array must have zero-based indexing.
- arrayIndex
- Int32
array
中从零开始的索引,从此处开始复制。The zero-based index in array
at which copying begins.
例外
array
为 null
。array
is null
.
arrayIndex
小于 0。arrayIndex
is less than 0.
源 ICollection<T> 中的元素个数大于从 arrayIndex
到目标 array
末尾之间的可用空间。The number of elements in the source ICollection<T> is greater than the available space from arrayIndex
to the end of the destination array
.