PortTypeCollection::IndexOf Method (PortType^)

 

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

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

public:
int IndexOf(
	PortType^ portType
)

Parameters

portType
Type: System.Web.Services.Description::PortType^

The PortType for which to search in the collection.

Return Value

Type: System::Int32

A 32-bit signed integer.

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 );

.NET Framework
Available since 1.1
Return to top
Show: