PortTypeCollection.CopyTo Method (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(
	PortType[] array,
	int index
)

Parameters

array
Type: 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: " 
   + myServiceDescription.PortTypes.Count);

// Copy the collection into an array.
 PortType[] myPortTypeArray = new PortType[noOfPortTypes];
 myPortTypeCollection.CopyTo(myPortTypeArray, 0);

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

.NET Framework
Available since 1.1
Return to top
Show: