This documentation is archived and is not being maintained.
NameValueCollection.CopyTo Method
.NET Framework 1.1
Copies the entire NameValueCollection to a compatible one-dimensional Array, starting at the specified index of the target 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 one-dimensional Array that is the destination of the elements copied from NameValueCollection. The Array must have zero-based indexing.
- index
- The zero-based index in dest at which copying begins.
Exceptions
| Exception Type | Condition |
|---|---|
| ArgumentNullException | dest is a null reference (Nothing in Visual Basic). |
| ArgumentOutOfRangeException | index is less than zero. |
| ArgumentException | dest is multidimensional.
-or- index is equal to or greater than the length of dest. -or- The number of elements in the source NameValueCollection is greater than the available space from index to the end of the destination dest. |
| InvalidCastException | The type of the source NameValueCollection cannot be cast automatically to the type of the destination dest. |
Remarks
The specified array must be of a compatible type.
This method uses Array.Copy to copy the elements.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Common Language Infrastructure (CLI) Standard
See Also
NameValueCollection Class | NameValueCollection Members | System.Collections.Specialized Namespace
Show: