다음을 통해 공유


PortCollection.CopyTo(Port[], Int32) 메서드

정의

대상 배열의 지정된 인덱스(0부터 시작)에서 시작하여 전체 PortCollectionPort 형식의 1차원 배열에 복사합니다.

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)

매개 변수

array
Port[]

복사될 대상인 Port 형식의 배열입니다.

index
Int32

복사된 컬렉션을 배치하기 시작할 인덱스(0부터 시작)입니다.

예제

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

적용 대상