Freigeben über


PortTypeCollection.IndexOf-Methode

Sucht nach dem angegebenen PortType und gibt den nullbasierten Index des ersten Vorkommens in der Auflistung zurück.

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)

Syntax

'Declaration
Public Function IndexOf ( _
    portType As PortType _
) As Integer
'Usage
Dim instance As PortTypeCollection
Dim portType As PortType
Dim returnValue As Integer

returnValue = instance.IndexOf(portType)
public int IndexOf (
    PortType portType
)
public:
int IndexOf (
    PortType^ portType
)
public int IndexOf (
    PortType portType
)
public function IndexOf (
    portType : PortType
) : int

Parameter

  • portType
    Der PortType, nach dem in der Auflistung gesucht werden soll.

Rückgabewert

Eine 32-Bit-Ganzzahl mit Vorzeichen.

Beispiel

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)
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);
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_JSL.wsdl");

PortTypeCollection myPortTypeCollection = 
    myServiceDescription.get_PortTypes();
int noOfPortTypes = myServiceDescription.get_PortTypes().get_Count();
Console.WriteLine("\nTotal number of PortTypes: " + noOfPortTypes);

PortType myNewPortType = 
    myPortTypeCollection.get_Item("MathServiceSoap");

// Get the index in the collection.
int index = myPortTypeCollection.IndexOf(myNewPortType);

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

PortTypeCollection-Klasse
PortTypeCollection-Member
System.Web.Services.Description-Namespace