PortTypeCollection::CopyTo Method (array<PortType^>^, Int32)

 

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

Namespace:   System.Web.Services.Description
Assembly:  System.Web.Services (in System.Web.Services.dll)

public:
void CopyTo(
	array<PortType^>^ array,
	int index
)

Parameters

array
Type: array<System.Web.Services.Description::PortType^>^

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

index
Type: System::Int32

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

PortTypeCollection^ myPortTypeCollection;

ServiceDescription^ myServiceDescription =
   ServiceDescription::Read( "MathService_CS.wsdl" );

myPortTypeCollection = myServiceDescription->PortTypes;
int noOfPortTypes = myServiceDescription->PortTypes->Count;
Console::WriteLine( "\nTotal number of PortTypes: {0}",
   myServiceDescription->PortTypes->Count );

// Copy the collection into an array.
array<PortType^>^ myPortTypeArray = gcnew array<PortType^>(noOfPortTypes);
myPortTypeCollection->CopyTo( myPortTypeArray, 0 );

// Display names of all PortTypes.
for ( int i = 0; i < noOfPortTypes; i++ )
{
   Console::WriteLine( "PortType name: {0}", myPortTypeArray[ i ]->Name );
}
myServiceDescription->Write( "MathService_New.wsdl" );

.NET Framework
Available since 1.1
Return to top
Show: