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 cíl hodnot zkopírovaných z kolekce.

index
Int32

Index pole, na který chcete začít vkládat.

Výjimky

Cílové pole je multidimenzionální.

nebo

Počet prvků v objektu CodeStatementCollection je větší než dostupný prostor mezi indexem cílového pole určeného 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 zkopí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.
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é