CookieCollection.CopyTo Method

Definition

Copies the elements of this CookieCollection to the specified destination array.

Overloads

CopyTo(Array, Int32)

Copies the elements of a CookieCollection to the specified array, starting at a particular index.

CopyTo(Cookie[], Int32)

Copies the elements of this CookieCollection to a Cookie array starting at the specified index of the target array.

CopyTo(Array, Int32)

Source:
CookieCollection.cs
Source:
CookieCollection.cs
Source:
CookieCollection.cs

Copies the elements of a CookieCollection to the specified array, starting at a particular index.

C#
public void CopyTo(Array array, int index);

Parameters

array
Array

The target array to which the CookieCollection will be copied.

index
Int32

The zero-based index in the target array where copying begins.

Implements

Exceptions

array is null.

index is less than zero.

array is multidimensional.

-or-

The number of elements in this CookieCollection is greater than the available space from index to the end of the destination array.

The elements in this CookieCollection cannot be cast automatically to the type of the destination array.

Remarks

The Array array parameter must be one-dimensional with zero-based indexing.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

CopyTo(Cookie[], Int32)

Source:
CookieCollection.cs
Source:
CookieCollection.cs
Source:
CookieCollection.cs

Copies the elements of this CookieCollection to a Cookie array starting at the specified index of the target array.

C#
public void CopyTo(System.Net.Cookie[] array, int index);

Parameters

array
Cookie[]

The target Cookie array to which the CookieCollection will be copied.

index
Int32

The zero-based index in the target array where copying begins.

Implements

Exceptions

array is null.

index is less than zero.

array is multidimensional.

-or-

The number of elements in this CookieCollection is greater than the available space from index to the end of the destination array.

The elements in this CookieCollection cannot be cast automatically to the type of the destination array.

Remarks

The array parameter must be one-dimensional with zero-based indexing.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1