共用方式為


OperationBindingCollection.CopyTo(OperationBinding[], Int32) 方法

定義

複製整個 OperationBindingCollectionOperationBinding 型別的相容一維陣列,從目標陣列的指定以零起始的索引位置開始。

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)

參數

array
OperationBinding[]

做為複製動作目的端的 OperationBinding 型別的陣列。

index
Int32

以零起始的索引,要於此處開始放置複製的集合。

範例

下列範例示範 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

適用於