ReadOnlyDictionary<TKey,TValue>.ICollection<KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair<TKey,TValue>[], Int32) 方法

定义

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

 virtual void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.CopyTo(cli::array <System::Collections::Generic::KeyValuePair<TKey, TValue>> ^ array, int arrayIndex) = System::Collections::Generic::ICollection<System::Collections::Generic::KeyValuePair<TKey, TValue>>::CopyTo;
void ICollection<KeyValuePair<TKey,TValue>>.CopyTo (System.Collections.Generic.KeyValuePair<TKey,TValue>[] array, int arrayIndex);
abstract member System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.CopyTo : System.Collections.Generic.KeyValuePair<'Key, 'Value>[] * int -> unit
override this.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.CopyTo : System.Collections.Generic.KeyValuePair<'Key, 'Value>[] * int -> unit
Sub CopyTo (array As KeyValuePair(Of TKey, TValue)(), arrayIndex As Integer) Implements ICollection(Of KeyValuePair(Of TKey, TValue)).CopyTo

参数

array
KeyValuePair<TKey,TValue>[]

作为从字典复制的元素的目标的一维数组。The one-dimensional array that is the destination of the elements copied from the dictionary. 该数组的索引必须从零开始。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 dictionary 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.

适用于