Επεξεργασία

Κοινή χρήση μέσω


OperationCollection.CopyTo(Operation[], Int32) Method

Definition

Copies the entire OperationCollection to a compatible one-dimensional array of type Operation, starting at the specified zero-based index of the target array.

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)

Parameters

array
Operation[]

An array of type Operation serving as the destination for the copy action.

index
Int32

The zero-based index at which to start placing the copied collection.

Examples

The following example demonstrates the use of the CopyTo method.

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

Applies to