HttpCookieCollection.CopyTo Method (Array, Int32)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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
Available since 1.1
Return to top