PortCollection::Item Property (String^)

 

Gets a Port specified by its name.

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

public:
property Port^ default[
	String^ name
] {
	Port^ get(String^ name);
}

Parameters

name
Type: System::String^

The name of the Port returned.

Property Value

Type: System.Web.Services.Description::Port^

A port specified by its name.

Service^ myService;
PortCollection^ myPortCollection;
ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathServiceItem_cs.wsdl" );
Console::WriteLine( "Total number of services : {0}", myServiceDescription->Services->Count );
for ( int i = 0; i < myServiceDescription->Services->Count; ++i )
{
   myService = myServiceDescription->Services[ i ];
   Console::WriteLine( "Name : {0}", myService->Name );
   myPortCollection = myService->Ports;

   // Create an array of ports.
   Console::WriteLine( "\nPort collection :" );
   for ( int i1 = 0; i1 < myService->Ports->Count; ++i1 )
   {
      Console::WriteLine( "Port[{0}] : {1}", i1, myPortCollection[ i1 ]->Name );
   }

   String^ strPort = myPortCollection[ 0 ]->Name;
   Port^ myPort = myPortCollection[ strPort ];
   Console::WriteLine( "\nIndex of Port[{0}] : {1}", strPort, myPortCollection->IndexOf( myPort ) );

.NET Framework
Available since 1.1
Return to top
Show: