ListTCopyTo Method (Int32, T, Int32, Int32) |
Copies a range of elements from the
ListT to a compatible one-dimensional array, starting at the specified index of the target array.
Namespace: System.Collections.GenericAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public void CopyTo(
int index,
T[] array,
int arrayIndex,
int count
)
Parameters
- index
- Type: SystemInt32
The zero-based index in the source ListT at which copying begins. - array
- Type: T
The one-dimensional Array that is the destination of the elements copied from ListT. The Array must have zero-based indexing. - arrayIndex
- Type: SystemInt32
The zero-based index in array at which copying begins. - count
- Type: SystemInt32
The number of elements to copy.
Exceptions Exception | Condition |
---|
ArgumentNullException | array is null. |
ArgumentOutOfRangeException | index is less than 0.-or-arrayIndex is less than 0.-or-count is less than 0. |
ArgumentException | index is equal to or greater than the Count of the source ListT.-or-The number of elements from index to the end of the source ListT is greater than the available space from arrayIndex to the end of the destination array. |
See Also