CodeStatementCollection.CopyTo(CodeStatement[], Int32) Metoda

Definice

Zkopíruje prvky objektu CodeStatementCollection do jednorozměrné Array instance počínaje zadaným indexem.

public:
 void CopyTo(cli::array <System::CodeDom::CodeStatement ^> ^ array, int index);
public void CopyTo (System.CodeDom.CodeStatement[] array, int index);
member this.CopyTo : System.CodeDom.CodeStatement[] * int -> unit
Public Sub CopyTo (array As CodeStatement(), index As Integer)

Parametry

array
CodeStatement[]

Jednorozměrná Array , která je cílem hodnot zkopírovaných z kolekce.

index
Int32

Index pole, ve kterém se má začít vkládat.

Výjimky

Cílové pole je multidimenzionální.

-nebo-

Počet prvků v objektu CodeStatementCollection je větší než dostupná mezera mezi indexem cílového pole určeným parametrem index a koncem cílového pole.

Parametr array je null.

Parametr index je menší než minimální index cílového pole.

Příklady

Následující příklad ukazuje, jak kopírovat obsah objektu CodeStatementCollection do pole počínaje zadanou hodnotou indexu.

// 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.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.
Dim statementArray(collection.Count - 1) As CodeStatement
collection.CopyTo(statementArray, 0)

Platí pro

Viz také