Partager via


OperationCollection.CopyTo(Operation[], Int32) Méthode

Définition

Copie OperationCollection dans son intégralité dans un tableau de type Operation compatible à une dimension en commençant à l'index de base zéro spécifié du tableau cible.

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

Paramètres

array
Operation[]

Tableau de type Operation servant de destination pour la copie.

index
Int32

Index de base zéro à partir duquel commencer à placer la collection copiée.

Exemples

L'exemple suivant illustre l'utilisation de la méthode CopyTo.

array<Operation^>^myOperationArray = gcnew array<Operation^>(myOperationCollection->Count);
myOperationCollection->CopyTo( myOperationArray, 0 );
Console::WriteLine( "The operation(s) in the collection are :" );
for ( int i = 0; i < myOperationCollection->Count; i++ )
{
   Console::WriteLine( " {0}", myOperationArray[ i ]->Name );
}
Operation[] myOperationArray = new Operation[
                                    myOperationCollection.Count];
myOperationCollection.CopyTo(myOperationArray, 0);
Console.WriteLine("The operation(s) in the collection are :");
for(int i = 0; i < myOperationCollection.Count; i++)
{
   Console.WriteLine(" " + myOperationArray[i].Name);
}
Dim myOperationArray(myOperationCollection.Count) As Operation
myOperationCollection.CopyTo(myOperationArray, 0)
Console.WriteLine("The operation(s) in the collection are :")
Dim i As Integer
For i = 0 To myOperationCollection.Count - 1
   Console.WriteLine(" " + myOperationArray(i).Name)
Next i

S’applique à