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
)
public void CopyTo (
	Array dest, 
	int index
)
public function CopyTo (
	dest : Array, 
	index : int
)
Not applicable.

Parameters

dest

The destination Array.

index

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

// Create the one-dimensional target array.
// Dimension it large enough to hold the cookies collection.
Array myArray = Array.CreateInstance(String.class.ToType(), 
    get_Request().get_Cookies().get_Count());

// Copy the entire collection to the array.
get_Request().get_Cookies().CopyTo(myArray, 0);

// Create the one-dimensional target Array.
 // Dimension it large enough to hold the cookies collection.
 var myArray : System.Array = System.Array.CreateInstance(System.String, Request.Cookies.Count)
 
 // Copy the entire cookies collection to the array.
 Request.Cookies.CopyTo(myArray, 0)
    

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft