Partager via


OperationBindingCollection.CopyTo(OperationBinding[], Int32) Méthode

Définition

Copie OperationBindingCollection dans son intégralité dans un tableau de type OperationBinding 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::OperationBinding ^> ^ array, int index);
public void CopyTo (System.Web.Services.Description.OperationBinding[] array, int index);
member this.CopyTo : System.Web.Services.Description.OperationBinding[] * int -> unit
Public Sub CopyTo (array As OperationBinding(), index As Integer)

Paramètres

array
OperationBinding[]

Tableau de type OperationBinding 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<OperationBinding^>^operationBindingArray =
      gcnew array<OperationBinding^>(myOperationBindingCollection->Count);

// Copy this collection to the OperationBinding array.
myOperationBindingCollection->CopyTo( operationBindingArray, 0 );
Console::WriteLine( "The operations supported by this service "
"are :" );

for each(OperationBinding^ myOperationBinding1 in operationBindingArray)
{
   Binding^ myBinding = myOperationBinding1->Binding;
   Console::WriteLine(" Binding : "+ myBinding->Name + " Name of " +
      "operation : " + myOperationBinding1->Name);
}
OperationBinding[] operationBindingArray = new
   OperationBinding[myOperationBindingCollection.Count];

// Copy this collection to the OperationBinding array.
myOperationBindingCollection.CopyTo(operationBindingArray, 0);
Console.WriteLine("The operations supported by this service " +
   "are :");
foreach(OperationBinding myOperationBinding1 in
   operationBindingArray)
{
   Binding myBinding = myOperationBinding1.Binding;
   Console.WriteLine(" Binding : "+ myBinding.Name + " Name of " +
      "operation : " + myOperationBinding1.Name);
}
Dim operationBindingArray(myOperationBindingCollection.Count -1  ) _
   As OperationBinding

' Copy this collection to the OperationBinding array.
myOperationBindingCollection.CopyTo(operationBindingArray, 0)
Console.WriteLine("The operations supported by this service " & _
   "are :")
Dim myOperationBinding1 As OperationBinding
For Each myOperationBinding1 In  operationBindingArray
   Dim myBinding As Binding = myOperationBinding1.Binding
   Console.WriteLine(" Binding : " & myBinding.Name & " Name of " & _
      "operation : " & myOperationBinding1.Name)
Next myOperationBinding1

S’applique à