Skip to main content
HttpCacheDirectiveHeaderValueCollection.CopyTo method

Applies to Windows and Windows Phone

Copies the elements of the collection to an array, starting at a particular array index in the destination array.

Syntax


public void CopyTo(
  HttpNameValueHeaderValue[] array, 
  int arrayIndex
)

Public Sub CopyTo(
  array As HttpNameValueHeaderValue(),  
  arrayIndex As Integer 
)

Parameters

array

Type: array of HttpNameValueHeaderValue

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

arrayIndex

Type: System.Int32

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

Remarks

The elements are copied to the array in the same order in which the enumerator iterates through the collection. It's typical to specify arrayIndex as 0 if all you're doing is making a simple copy of the collection items, where you've created a destination array with a length that matches the Count of the collection you're copying.

This method will throw an exception if the number of elements in the source collection is greater than the length of the destination array.

If you are programming using Visual C++ component extensions (C++/CX), GetMany has similar behavior to CopyTo, but note that the parameters are in a different order. Or you can make an IVectorView copy by calling GetView.

Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Web.Http.Headers

See also

HttpCacheDirectiveHeaderValueCollection
Array
GetMany