Redigera

Dela via


PortTypeCollection.IndexOf(PortType) Method

Definition

Searches for the specified PortType and returns the zero-based index of the first occurrence within the collection.

public:
 int IndexOf(System::Web::Services::Description::PortType ^ portType);
public int IndexOf (System.Web.Services.Description.PortType portType);
member this.IndexOf : System.Web.Services.Description.PortType -> int
Public Function IndexOf (portType As PortType) As Integer

Parameters

portType
PortType

The PortType for which to search in the collection.

Returns

A 32-bit signed integer.

Examples

ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" );
PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes;
int noOfPortTypes = myServiceDescription->PortTypes->Count;
Console::WriteLine( "\nTotal number of PortTypes: {0}", noOfPortTypes );
PortType^ myNewPortType = myPortTypeCollection[ "MathServiceSoap" ];

// Get the index in the collection.
int index = myPortTypeCollection->IndexOf( myNewPortType );
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);
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)

Applies to