Diese Dokumentation wurde archiviert und wird nicht länger gepflegt.

PortCollection-Klasse

Stellt eine Auflistung von Instanzen der Port-Klasse dar. Diese Klasse kann nicht geerbt werden.

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

public sealed class PortCollection : ServiceDescriptionBaseCollection
public final class PortCollection extends ServiceDescriptionBaseCollection
public final class PortCollection extends ServiceDescriptionBaseCollection

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


   Port myPortTestRemove = myPortCollection[0];

   Console.WriteLine("\nTotal number of ports before removing "
      + "a port '" + myPortTestRemove.Name +"' is : "
      + myService.Ports.Count);

   myPortCollection.Remove(myPortTestRemove);

   Console.WriteLine("Total number of ports after removing "
      + "a port '" + myPortTestRemove.Name +"' is : "
      + myService.Ports.Count);

   // Create the WSDL file.
   myPortCollection.Insert(0, myPortTestRemove);
   myServiceDescription.Write("MathServiceItemNew_cs.wsdl");

Service myService;
PortCollection myPortCollection;

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

Console.WriteLine("Total number of services : " 
    + myServiceDescription.get_Services().get_Count());

for (int i = 0; i < myServiceDescription.get_Services().
    get_Count(); ++i) {
    myService = myServiceDescription.get_Services().get_Item(i);
    Console.WriteLine("Name : " + myService.get_Name());
    myPortCollection = myService.get_Ports();

    // Create an array of ports.
    Console.WriteLine("\nPort collection :");
    for (int i1 = 0; i1 < myService.get_Ports().get_Count();
        ++i1) {
        Console.WriteLine("Port[" + i1 + "] : " 
            + myPortCollection.get_Item(i1).get_Name());
    }

    String strPort = myPortCollection.get_Item(0).get_Name();
    Port myPort = myPortCollection.get_Item(strPort);
    Console.WriteLine("\nIndex of Port[" + strPort + "] : " 
        + myPortCollection.IndexOf(myPort));

    Port myPortTestRemove = myPortCollection.get_Item(0);

    Console.WriteLine("\nTotal number of ports before removing " 
        + "a port '" + myPortTestRemove.get_Name() + "' is : " 
        + myService.get_Ports().get_Count());

    myPortCollection.Remove(myPortTestRemove);

    Console.WriteLine("Total number of ports after removing " 
        + "a port '" + myPortTestRemove.get_Name() + "' is : " 
        + myService.get_Ports().get_Count());

    // Create the WSDL file.
    myPortCollection.Insert(0, myPortTestRemove);
    myServiceDescription.Write("MathServiceItemNew_jsl.wsdl");

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

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.

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0
Anzeigen: