Condividi tramite


PortTypeCollection.IndexOf(PortType) Metodo

Definizione

Cerca l'oggetto PortType specificato e restituisce l'indice in base zero della prima occorrenza all'interno dell'insieme.

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

Parametri

portType
PortType

Oggetto PortType da cercare nell'insieme.

Restituisce

Intero con segno a 32 bit.

Esempio

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)

Si applica a