CopyTo Method (T[], Int32)

Task Parallel System.Threading

Copies the elements of the IProducerConsumerCollection<(Of <(T>)>) to an Array, starting at a specified index.

Namespace:  System.Collections.Concurrent
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Sub CopyTo ( _
	array As T(), _
	index As Integer _
)
C#
void CopyTo(
	T[] array,
	int index
)

Parameters

array
Type: array< T >[]()[]
The one-dimensional Array that is the destination of the elements copied from the IProducerConsumerCollection<(Of <(T>)>). The array must have zero-based indexing.
index
Type: System..::.Int32
The zero-based index in array at which copying begins.

Exceptions

ExceptionCondition
System..::.ArgumentNullExceptionarray is a null reference (Nothing in Visual Basic).
System..::.ArgumentOutOfRangeExceptionindex is less than zero.
System..::.ArgumentExceptionindex is equal to or greater than the length of the array -or- The number of elements in the source ConcurrentQueue<(Of <(T>)>) is greater than the available space from index to the end of the destination array.

See Also