This documentation is archived and is not being maintained.
HttpCookieCollection.CopyTo Method
.NET Framework 1.1
Copies members of the cookie collection to an Array beginning at the specified index of the array.
[Visual Basic] Public Sub CopyTo( _ ByVal dest As Array, _ ByVal index As Integer _ ) [C#] public void CopyTo( Array dest, int index ); [C++] public: void CopyTo( Array* dest, int index ); [JScript] public function CopyTo( dest : Array, index : int );
Parameters
- dest
- The destination Array.
- index
- The index of the destination array where copying starts.
Example
The following example copies the entire cookie collection into a new Array object.
[Visual Basic] ' 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) [C#] // 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 ); [C++] // 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 ); [JScript] // 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)
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
HttpCookieCollection Class | HttpCookieCollection Members | System.Web Namespace
Show: