NameValueCollection.CopyTo(Array, Int32) Method

Definition

Copies 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)

Parameters

dest
Array

The one-dimensional Array that is the destination of the elements copied from NameValueCollection. The Array must have zero-based indexing.

index
Int32

The zero-based index in dest at which copying begins.

Exceptions

dest is null.

index is less than zero.

dest is multidimensional.

-or-

The number of elements in the source NameValueCollection is greater than the available space from index to the end of the destination dest.

The type of the source NameValueCollection cannot be cast automatically to the type of the destination dest.

Remarks

The specified array must be of a compatible type.

This method uses Array.Copy to copy the elements.

This method is an O(n) operation, where n is Count.

Applies to