CodeDirectiveCollection.CopyTo(CodeDirective[], Int32) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Kopierar innehållet i samlingen till en endimensionell matris som börjar vid det angivna indexet.
public:
void CopyTo(cli::array <System::CodeDom::CodeDirective ^> ^ array, int index);
public void CopyTo(System.CodeDom.CodeDirective[] array, int index);
member this.CopyTo : System.CodeDom.CodeDirective[] * int -> unit
Public Sub CopyTo (array As CodeDirective(), index As Integer)
Parametrar
- array
- CodeDirective[]
En matris av typen CodeDirective som är målet för de värden som kopieras från samlingen.
- index
- Int32
Indexet i matrisen där samlingsobjekt ska infogas.
Undantag
Målmatrisen är flerdimensionell.
-eller-
Antalet element i CodeDirectiveCollection är större än det tillgängliga utrymmet mellan indexet för målmatrisen som anges av index och slutet av målmatrisen.
array är null.
index är mindre än målmatrisens minsta index.
Exempel
I följande kodexempel visas hur metoden används CopyTo för att kopiera innehållet i samlingen med början vid index 0 till den angivna CodeDirective matrisen. Det här exemplet är en del av ett större exempel som tillhandahålls CodeDirectiveCollection för klassen.
// Copies the contents of the collection beginning at index 0 to the specified CodeDirective array.
// 'directives' is a CodeDirective array.
collection.CopyTo(directives, 0);
' Copies the contents of the collection beginning at index 0 to the specified CodeDirective array.
' 'directives' is a CodeDirective array.
collection.CopyTo(directives, 0)