Freigeben über


CodeStatementCollection.CopyTo-Methode

Kopiert die Auflistungsobjekte in eine eindimensionale Array-Instanz, beginnend am angegebenen Index.

Namespace: System.CodeDom
Assembly: System (in system.dll)

Syntax

'Declaration
Public Sub CopyTo ( _
    array As CodeStatement(), _
    index As Integer _
)
'Usage
Dim instance As CodeStatementCollection
Dim array As CodeStatement()
Dim index As Integer

instance.CopyTo(array, index)
public void CopyTo (
    CodeStatement[] array,
    int index
)
public:
void CopyTo (
    array<CodeStatement^>^ array, 
    int index
)
public void CopyTo (
    CodeStatement[] array, 
    int index
)
public function CopyTo (
    array : CodeStatement[], 
    index : int
)

Parameter

  • array
    Das eindimensionale Array, das das Ziel der aus der Auflistung kopierten Werte ist.
  • index
    Der Index des Arrays, an dem mit dem Einfügen begonnen werden soll.

Ausnahmen

Ausnahmetyp Bedingung

ArgumentException

Das Zielarray ist mehrdimensional.

– oder –

Die Anzahl der Elemente in der CodeStatementCollection ist größer als der verfügbare Platz zwischen dem Index des Zielarrays, der durch den index-Parameter angegeben wird, und dem Ende des Zielarrays.

ArgumentNullException

Der array-Parameter ist NULL (Nothing in Visual Basic).

ArgumentOutOfRangeException

Der index-Parameter ist kleiner als der minimale Index des Zielarrays.

Beispiel

' Copies the contents of the collection beginning at index 0 to the specified CodeStatement array.
' 'statements' is a CodeStatement array.
Dim statementArray(collection.Count) As CodeStatement
collection.CopyTo(statementArray, 0)
// Copies the contents of the collection beginning at index 0 to the specified CodeStatement array.
// 'statements' is a CodeStatement array.
CodeStatement[] statementArray = new CodeStatement[collection.Count];
collection.CopyTo( statementArray, 0 );
// Copies the contents of the collection beginning at index 0 to the specified CodeStatement array.
// 'statements' is a CodeStatement array.
collection->CopyTo( statements, 0 );
// Copies the contents of the collection beginning at index 0 to the specified CodeStatement array.
// 'statements' is a CodeStatement array.
CodeStatement[] statementArray = new CodeStatement[collection.get_Count()];
collection.CopyTo( statementArray, 0 );

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

CodeStatementCollection-Klasse
CodeStatementCollection-Member
System.CodeDom-Namespace
Array-Klasse