Sdílet prostřednictvím


PortCollection.CopyTo(Port[], Int32) Metoda

Definice

Zkopíruje celek PortCollection do jednorozměrného pole typu Port, počínaje zadaným indexem od nuly cílového pole.

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

Parametry

array
Port[]

Pole typu Port , které slouží jako cíl akce kopírování.

index
Int32

Index založený na nule, do kterého chcete začít umísťovat zkopírovanou kolekci.

Příklady

myPortCollection = myService->Ports;

// Create an array of Port objects.
Console::WriteLine( "\nPort collection :" );
array<Port^>^myPortArray = gcnew array<Port^>(myService->Ports->Count);
myPortCollection->CopyTo( myPortArray, 0 );
for ( int i1 = 0; i1 < myService->Ports->Count; ++i1 )
{
   Console::WriteLine( "Port[{0}] : {1}", i1, myPortArray[ i1 ]->Name );

}
myPortCollection = myService.Ports;

// Create an array of Port objects.
Console.WriteLine("\nPort collection :");
Port[] myPortArray = new Port[myService.Ports.Count];
myPortCollection.CopyTo(myPortArray, 0);
for(int i1=0 ; i1 < myService.Ports.Count ; ++i1)
{
   Console.WriteLine("Port[" + i1+ "] : " + myPortArray[i1].Name);
}
myPortCollection = myService.Ports

' Create an array of Port objects.
Console.WriteLine(ControlChars.NewLine & "Port collection :")
Dim myPortArray(myService.Ports.Count) As Port
myPortCollection.CopyTo(myPortArray, 0)
Dim i1 As Integer
For i1 = 0 to myService.Ports.Count -1
   Console.WriteLine("Port[" & i1.ToString + "] : " & _
      myPortArray(i1).Name)
Next

Platí pro