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)

'Declaration
Public Sub CopyTo ( _
	dest As Array, _
	index As Integer _
)

Parameters

dest
Type: System.Array

The destination Array.

index
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. 
 Dim MyArray As Array = Array.CreateInstance(GetType(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
Show:
© 2015 Microsoft