CopyTo Method (T[], Int32)
Collapse the table of content
Expand the table of content

HashSet(Of T).CopyTo Method (T(), Int32)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Copies the elements of a HashSet(Of T) object to an array, starting at the specified array index.

Namespace:  System.Collections.Generic
Assembly:  System.Core (in System.Core.dll)

'Declaration
Public Sub CopyTo ( _
	array As T(), _
	arrayIndex As Integer _
)

Parameters

array
Type: T ()
The one-dimensional array that is the destination of the elements copied from the HashSet(Of T) object. The array must have zero-based indexing.
arrayIndex
Type: System.Int32
The zero-based index in array at which copying begins.

Implements

ICollection(Of T).CopyTo(T(), Int32)

ExceptionCondition
ArgumentNullException

array is Nothing.

ArgumentOutOfRangeException

arrayIndex is less than 0.

ArgumentException

arrayIndex is greater than the length of the destination array.

-or-

count is larger than the size of the destination array.

This method is an O(n) operation, where n is Count.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft