This documentation is archived and is not being maintained.
PortTypeCollection.CopyTo Method
.NET Framework 1.1
Copies the entire PortTypeCollection to a one-dimensional array of type PortType, starting at the specified zero-based index of the target array.
[Visual Basic] Public Sub CopyTo( _ ByVal array() As PortType, _ ByVal index As Integer _ ) [C#] public void CopyTo( PortType[] array, int index ); [C++] public: void CopyTo( PortType* array[], int index ); [JScript] public function CopyTo( array : PortType[], index : int );
Parameters
- array
- An array of type PortType serving as the destination for the copy action.
- index
- The zero-based index at which to start placing the copied collection.
Example
[Visual Basic] Dim myPortTypeCollection As PortTypeCollection Dim myServiceDescription As ServiceDescription = _ ServiceDescription.Read("MathService_VB.wsdl") myPortTypeCollection = myServiceDescription.PortTypes Dim noOfPortTypes As Integer = myServiceDescription.PortTypes.Count Console.WriteLine( _ ControlChars.NewLine + "Total number of PortTypes: " & _ myServiceDescription.PortTypes.Count.ToString()) ' Copy the collection into an array. Dim myPortTypeArray(noOfPortTypes-1) As PortType myPortTypeCollection.CopyTo(myPortTypeArray, 0) ' Display names of all PortTypes. Dim i As Integer For i = 0 To noOfPortTypes - 1 Console.WriteLine("PortType Name: " + myPortTypeArray(i).Name) Next i myServiceDescription.Write("MathService_New.wsdl") [C#] 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"); [C++] PortTypeCollection* myPortTypeCollection; ServiceDescription* myServiceDescription = ServiceDescription::Read(S"MathService_CS.wsdl"); myPortTypeCollection = myServiceDescription->PortTypes; int noOfPortTypes = myServiceDescription->PortTypes->Count; Console::WriteLine(S"\nTotal number of PortTypes: {0}", __box(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(S"PortType name: {0}", myPortTypeArray[i]->Name); myServiceDescription->Write(S"MathService_New.wsdl");
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
PortTypeCollection Class | PortTypeCollection Members | System.Web.Services.Description Namespace
Show: