PortCollection.CopyTo(Port[], Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Copies the entire PortCollection to a one-dimensional array of type Port, starting at the specified zero-based index of the target array.
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)
Parameters
- index
- Int32
The zero-based index at which to start placing the copied collection.
Examples
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
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.