Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

HttpCookieCollection.CopyTo Method

Copies members of the cookie collection to an Array beginning at the specified index of the array.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)

public void CopyTo(
	Array dest,
	int index


Type: System.Array

The destination Array.

Type: System.Int32

The index of the destination array where copying starts.

The following example copies the entire cookie collection into a new Array object.

// Create the one-dimensional target array. 
 // Dimension it large enough to hold the cookies collection.
 Array MyArray = Array.CreateInstance( typeof(String), Request.Cookies.Count );

 // Copy the entire collection to the array.
 Request.Cookies.CopyTo( MyArray, 0 );

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
© 2015 Microsoft