ReadOnlyDictionary<TKey,TValue>.KeyCollection.ICollection.CopyTo(Array, Int32) 方法

定義

從特定的陣列索引開始,將集合的元素複製到陣列中。Copies the elements of the collection to an array, starting at a specific 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
Array

從集合複製項目之目的端一維陣列。The one-dimensional array that is the destination of the elements copied from the collection. 陣列必須有以零為起始的索引。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.

array 是多維的。array is multidimensional.

-或--or- 來源集合中的項目數目大於從 index 到目的端 array 結尾的可用空間。The number of elements in the source collection is greater than the available space from index to the end of the destination array.

備註

這個成員是明確介面成員實作,This member is an explicit interface member implementation. 只有在 ReadOnlyDictionary<TKey,TValue>.KeyCollection 執行個體轉換成 ICollection 介面時,才能使用這個成員。It can be used only when the ReadOnlyDictionary<TKey,TValue>.KeyCollection instance is cast to an ICollection interface.

適用於