ListBox.ObjectCollection.CopyTo(Object[], Int32) Metod

Definition

Kopierar hela samlingen till en befintlig matris med objekt på en angiven plats i matrisen.

public:
 void CopyTo(cli::array <System::Object ^> ^ dest, int arrayIndex);
public:
 void CopyTo(cli::array <System::Object ^> ^ destination, int arrayIndex);
public void CopyTo(object[] dest, int arrayIndex);
public void CopyTo(object[] destination, int arrayIndex);
member this.CopyTo : obj[] * int -> unit
member this.CopyTo : obj[] * int -> unit
Public Sub CopyTo (dest As Object(), arrayIndex As Integer)
Public Sub CopyTo (destination As Object(), arrayIndex As Integer)

Parametrar

destdestination
Object[]

Objektmatrisen som objekten från samlingen kopieras till.

arrayIndex
Int32

Platsen i målmatrisen som objekten ska kopieras från samlingen till.

Undantag

.NET 5 och senare: destination är null.

Kommentarer

Du kan använda den här metoden för att kombinera objekt från flera samlingar till en enda matris. Du kan sedan använda den här matrisen för att fylla i innehållet i en annan ListBox kontroll med hjälp AddRange av -klassens ListBox.ObjectCollection metod.

Gäller för