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

定義

從指定的陣列索引處開始,將 ICollection<T> 的項目複製到 KeyValuePair<TKey,TValue> 類型的陣列。Copies the elements of the ICollection<T> to an array of type KeyValuePair<TKey,TValue>, 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 index) = 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 index);
Sub CopyTo (array As KeyValuePair(Of TKey, TValue)(), index As Integer) Implements ICollection(Of KeyValuePair(Of TKey, TValue)).CopyTo

參數

array
KeyValuePair<TKey,TValue>[]

KeyValuePair<TKey,TValue> 類型的一維陣列,是從 ICollection<T> 複製過來之 KeyValuePair<TKey,TValue> 項目的目的地。The one-dimensional array of type KeyValuePair<TKey,TValue> that is the destination of the KeyValuePair<TKey,TValue> elements copied from the ICollection<T>. 陣列必須有以零為起始的索引。The array must have zero-based indexing.

index
Int32

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

例外狀況

arraynullarray is null.

index 小於 0。index is less than 0.

來源 ICollection<T> 中的項目數目,大於 index 到目的 array 結尾的可用空間。The number of elements in the source ICollection<T> is greater than the available space from index to the end of the destination array.

適用於