PortCollection.Item[] Proprietà

Definizione

Ottiene o imposta l'istanza di Port specificata dal parametro passato.

Overload

Item[Int32]

Ottiene o imposta il valore di un oggetto Port in corrispondenza dell'indice in base zero specificato.

Item[String]

Ottiene un oggetto Port specificato in base al nome.

Item[Int32]

Origine:
ServiceDescription.cs
Origine:
ServiceDescription.cs
Origine:
ServiceDescription.cs

Ottiene o imposta il valore di un oggetto Port in corrispondenza dell'indice in base zero specificato.

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

Parametri

index
Int32

Indice in base zero di Port il cui valore viene modificato o restituito.

Valore della proprietà

Valore di una porta in corrispondenza dell'indice specificato.

Esempio

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

Si applica a

Item[String]

Origine:
ServiceDescription.cs
Origine:
ServiceDescription.cs
Origine:
ServiceDescription.cs

Ottiene un oggetto Port specificato in base al nome.

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

Parametri

name
String

Nome dell'oggetto Port restituito.

Valore della proprietà

Porta specificata in base al nome.

Esempio

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)

Si applica a