Export (0) Print
Expand All

NameObjectCollectionBase.ICollection.CopyTo Method

.NET Framework 1.1

Copies the entire NameObjectCollectionBase to a compatible one-dimensional Array, starting at the specified index of the target array.

[Visual Basic]
Private Sub CopyTo( _
   ByVal array As Array, _
   ByVal index As Integer _
) Implements ICollection.CopyTo
[C#]
void ICollection.CopyTo(
   Array array,
 int index
);
[C++]
private: void ICollection::CopyTo(
 Array* array,
 int index
);
[JScript]
private function ICollection.CopyTo(
   array : Array,
 index : int
);

Parameters

array
The one-dimensional Array that is the destination of the elements copied from NameObjectCollectionBase. The Array must have zero-based indexing.
index
The zero-based index in array at which copying begins.

Implements

ICollection.CopyTo

Exceptions

Exception Type Condition
ArgumentNullException array is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeException index is less than zero.
ArgumentException array is multidimensional.

-or-

index is equal to or greater than the length of array.

-or-

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

InvalidCastException The type of the source NameObjectCollectionBase cannot be cast automatically to the type of the destination array.

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

See Also

NameObjectCollectionBase Class | NameObjectCollectionBase Members | System.Collections.Specialized Namespace

Show:
© 2015 Microsoft