NameValueCollection.CopyTo(Array, Int32) 方法

定義

從目標陣列的指定索引開始,將整個 NameValueCollection 複製到相容的一維 ArrayCopies the entire NameValueCollection to a compatible one-dimensional Array, starting at the specified index of the target array.

public:
 void CopyTo(Array ^ dest, int index);
public void CopyTo (Array dest, int index);
member this.CopyTo : Array * int -> unit
Public Sub CopyTo (dest As Array, index As Integer)

參數

dest
Array

一維 Array,是從 NameValueCollection 複製過來之項目的目的端。The one-dimensional Array that is the destination of the elements copied from NameValueCollection. Array 必須有以零為起始的索引。The Array must have zero-based indexing.

index
Int32

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

例外狀況

destnulldest is null.

index 小於零。index is less than zero.

dest 是多維的。dest is multidimensional.

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

來源 NameValueCollection 的類型無法自動轉換成目的 dest 的類型。The type of the source NameValueCollection cannot be cast automatically to the type of the destination dest.

備註

指定的陣列必須是相容的類型。The specified array must be of a compatible type.

這個方法會Array.Copy使用來複製元素。This method uses Array.Copy to copy the elements.

這個方法是 O (n)運算,其中nCountThis method is an O(n) operation, where n is Count.

適用於