This documentation is archived and is not being maintained.
PortTypeCollection.IndexOf Method
.NET Framework 1.1
Searches for the specified PortType and returns the zero-based index of the first occurrence within the collection.
[Visual Basic] Public Function IndexOf( _ ByVal portType As PortType _ ) As Integer [C#] public int IndexOf( PortType portType ); [C++] public: int IndexOf( PortType* portType ); [JScript] public function IndexOf( portType : PortType ) : int;
Parameters
- portType
- The PortType for which to search in the collection.
Return Value
A 32-bit signed integer.
Example
[Visual Basic] Dim myServiceDescription As ServiceDescription = _ ServiceDescription.Read("MathService_VB.wsdl") Dim myPortTypeCollection As PortTypeCollection = _ myServiceDescription.PortTypes Dim noOfPortTypes As Integer = myServiceDescription.PortTypes.Count Console.WriteLine(ControlChars.Newline & _ "Total number of PortTypes: " & noOfPortTypes.ToString()) Dim myNewPortType As PortType = myPortTypeCollection("MathServiceSoap") ' Get the index in the collection. Dim index As Integer = myPortTypeCollection.IndexOf(myNewPortType) [C#] ServiceDescription myServiceDescription = ServiceDescription.Read("MathService_CS.wsdl"); PortTypeCollection myPortTypeCollection = myServiceDescription.PortTypes; int noOfPortTypes = myServiceDescription.PortTypes.Count; Console.WriteLine("\nTotal number of PortTypes: " + noOfPortTypes); PortType myNewPortType = myPortTypeCollection["MathServiceSoap"]; // Get the index in the collection. int index = myPortTypeCollection.IndexOf(myNewPortType); [C++] ServiceDescription* myServiceDescription = ServiceDescription::Read(S"MathService_CS.wsdl"); PortTypeCollection* myPortTypeCollection = myServiceDescription->PortTypes; int noOfPortTypes = myServiceDescription->PortTypes->Count; Console::WriteLine(S"\nTotal number of PortTypes: {0}", __box(noOfPortTypes)); PortType* myNewPortType = myPortTypeCollection->Item[S"MathServiceSoap"]; // Get the index in the collection. int index = myPortTypeCollection->IndexOf(myNewPortType);
[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: