PortCollection.Item[] Property

Definition

Gets or sets the Port instance specified by the parameter passed in.

Overloads

Item[Int32]

Gets or sets the value of a Port at the specified zero-based index.

Item[String]

Gets a Port specified by its name.

Item[Int32]

Source:
ServiceDescription.cs
Source:
ServiceDescription.cs
Source:
ServiceDescription.cs

Gets or sets the value of a Port at the specified zero-based index.

public:
 property System::Web::Services::Description::Port ^ default[int] { System::Web::Services::Description::Port ^ get(int index); void set(int index, System::Web::Services::Description::Port ^ value); };
public System.Web.Services.Description.Port this[int index] { get; set; }
member this.Item(int) : System.Web.Services.Description.Port with get, set
Default Public Property Item(index As Integer) As Port

Parameters

index
Int32

The zero-based index of the Port whose value is modified or returned.

Property Value

The value of a port at the specified index.

Examples

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 );
   }
Service myService;
PortCollection myPortCollection;

ServiceDescription myServiceDescription =
   ServiceDescription.Read("MathServiceItem_cs.wsdl");

Console.WriteLine("Total number of services : "
   + myServiceDescription.Services.Count);

for(int i=0; i < myServiceDescription.Services.Count; ++i)
{
   myService = myServiceDescription.Services[i];
   Console.WriteLine("Name : " + 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[" + i1+"] : " +
         myPortCollection[i1].Name);
   }
Dim myService As Service
Dim myPortCollection As PortCollection

Dim myServiceDescription As ServiceDescription = _
   ServiceDescription.Read("MathServiceItem_vb.wsdl")

Console.WriteLine("Total number of services : " & _
   myServiceDescription.Services.Count.ToString)

Dim i As Integer
For i = 0 to myServiceDescription.Services.Count - 1
   myService = myServiceDescription.Services(i)
   Console.WriteLine("Name : " & myService.Name)

   myPortCollection = myService.Ports

   ' Create an array of ports.
   Console.WriteLine(ControlChars.NewLine & "Port collection :")
   Dim i1 As Integer
   For i1 = 0 to myService.Ports.Count - 1
      Console.WriteLine("Port[" & i1.ToString & "] : " & _
         myPortCollection(i1).Name)
   Next

Applies to

Item[String]

Source:
ServiceDescription.cs
Source:
ServiceDescription.cs
Source:
ServiceDescription.cs

Gets a Port specified by its name.

public:
 property System::Web::Services::Description::Port ^ default[System::String ^] { System::Web::Services::Description::Port ^ get(System::String ^ name); };
public System.Web.Services.Description.Port this[string name] { get; }
member this.Item(string) : System.Web.Services.Description.Port
Default Public ReadOnly Property Item(name As String) As Port

Parameters

name
String

The name of the Port returned.

Property Value

A port specified by its name.

Examples

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 ) );
Service myService;
PortCollection myPortCollection;

ServiceDescription myServiceDescription =
   ServiceDescription.Read("MathServiceItem_cs.wsdl");

Console.WriteLine("Total number of services : "
   + myServiceDescription.Services.Count);

for(int i=0; i < myServiceDescription.Services.Count; ++i)
{
   myService = myServiceDescription.Services[i];
   Console.WriteLine("Name : " + 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[" + i1+"] : " +
         myPortCollection[i1].Name);
   }

   string strPort = myPortCollection[0].Name;
   Port myPort = myPortCollection[strPort];
   Console.WriteLine("\nIndex of Port[" + strPort + "] : " +
      myPortCollection.IndexOf(myPort));
Dim myService As Service
Dim myPortCollection As PortCollection

Dim myServiceDescription As ServiceDescription = _
   ServiceDescription.Read("MathServiceItem_vb.wsdl")

Console.WriteLine("Total number of services : " & _
   myServiceDescription.Services.Count.ToString)

Dim i As Integer
For i = 0 to myServiceDescription.Services.Count - 1
   myService = myServiceDescription.Services(i)
   Console.WriteLine("Name : " & myService.Name)

   myPortCollection = myService.Ports

   ' Create an array of ports.
   Console.WriteLine(ControlChars.NewLine & "Port collection :")
   Dim i1 As Integer
   For i1 = 0 to myService.Ports.Count - 1
      Console.WriteLine("Port[" & i1.ToString & "] : " & _
         myPortCollection(i1).Name)
   Next
   Dim strPort As String = myPortCollection(0).Name
   Dim myPort As Port = myPortCollection(strPort)
   Console.WriteLine(ControlChars.NewLine & _
      "Index of Port[" & strPort & "] : " & _
      myPortCollection.IndexOf(myPort).ToString)

Applies to