다음을 통해 공유


HashSet<T>.CopyTo Method (array<T[])

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Copies the elements of a HashSet<T> object to an array.

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

Syntax

'Declaration
Public Sub CopyTo ( _
    array As T() _
)
public void CopyTo(
    T[] array
)

Parameters

  • array
    Type: array<T[]
    The one-dimensional array that is the destination of the elements copied from the HashSet<T> object. The array must have zero-based indexing.

Exceptions

Exception Condition
ArgumentNullException

array is nulla null reference (Nothing in Visual Basic).

Remarks

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

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.