CodeTypeDeclarationCollection.CopyTo(CodeTypeDeclaration[], Int32) Metod

Definition

Kopierar elementen CodeTypeDeclarationCollection i objektet till en endimensionell Array instans med början vid det angivna indexet.

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

Parametrar

array
CodeTypeDeclaration[]

Den endimensionella Array som är målet för de värden som kopieras från samlingen.

index
Int32

Indexet för matrisen som ska börja infogas.

Undantag

Målmatrisen är flerdimensionell.

-eller-

Antalet element i CodeTypeDeclarationCollection är större än det tillgängliga utrymmet mellan indexet för målmatrisen som anges av parametern index och slutet av målmatrisen.

Parametern array är null.

Parametern index är mindre än målmatrisens minsta index.

Exempel

I följande exempel visas hur du använder CopyTo metoden för att kopiera innehållet i ett CodeTypeDeclarationCollection objekt till en matris, med början vid det angivna indexvärdet.

// Copies the contents of the collection, beginning at index 0,
// to the specified CodeTypeDeclaration array.
// 'declarations' is a CodeTypeDeclaration array.
collection.CopyTo( declarations, 0 );
' Copies the contents of the collection, beginning at index 0,
' to the specified CodeTypeDeclaration array.
' 'declarations' is a CodeTypeDeclaration array.
collection.CopyTo(declarations, 0)

Gäller för

Se även