PortTypeCollection Klasse

Definition

Stellt eine Auflistung von Instanzen der PortType-Klasse dar, d. h. eine Auflistung von Gruppen der Vorgänge, die vom XML-Webdienst unterstützt werden. Diese Klasse kann nicht vererbt werden.

public ref class PortTypeCollection sealed : System::Web::Services::Description::ServiceDescriptionBaseCollection
public sealed class PortTypeCollection : System.Web.Services.Description.ServiceDescriptionBaseCollection
type PortTypeCollection = class
    inherit ServiceDescriptionBaseCollection
Public NotInheritable Class PortTypeCollection
Inherits ServiceDescriptionBaseCollection
Vererbung

Beispiele

#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>

using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Xml;
using namespace System::Collections;
int main()
{
   try
   {
      // Read the existing Web service description file.
      ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" );
      PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes;
      int noOfPortTypes = myServiceDescription->PortTypes->Count;
      Console::WriteLine( "\nTotal number of PortTypes: {0}", myServiceDescription->PortTypes->Count );

      // Get the first PortType in the collection.
      PortType^ myNewPortType = myPortTypeCollection[ "MathServiceSoap" ];
      int index = myPortTypeCollection->IndexOf( myNewPortType );
      Console::WriteLine( "The PortType with the name {0} is at index: {1}", myNewPortType->Name, (index + 1) );
      Console::WriteLine( "Removing the PortType: {0}", myNewPortType->Name );

      // Remove the PortType from the collection.
      myPortTypeCollection->Remove( myNewPortType );
      bool bContains = myPortTypeCollection->Contains( myNewPortType );
      Console::WriteLine( "The PortType with the name {0} exists: {1}", myNewPortType->Name, bContains );
      Console::WriteLine( "Total number of PortTypes after removing: {0}", myServiceDescription->PortTypes->Count );
      Console::WriteLine( "Adding a PortType: {0}", myNewPortType->Name );

      // Add a new portType from the collection.
      myPortTypeCollection->Add( myNewPortType );

      // Display the number of portTypes after adding a port.
      Console::WriteLine( "Total number of PortTypes after adding a new port: {0}", myServiceDescription->PortTypes->Count );

      // List the PortTypes available in the WSDL document.
      IEnumerator^ myEnum = myPortTypeCollection->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         PortType^ myPortType = safe_cast<PortType^>(myEnum->Current);
         Console::WriteLine( "The PortType name is: {0}", myPortType->Name );
      }
      myServiceDescription->Write( "MathService_New.wsdl" );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception: {0}", e->Message );
   }
}
using System;
using System.Web.Services.Description;
using System.Xml;
using System.Collections;

class MyPortTypeCollectionClass
{
   public static void Main()
   {
      try
      {
         // Read the existing Web service description file.
         ServiceDescription myServiceDescription =
            ServiceDescription.Read("MathService_CS.wsdl");
         PortTypeCollection myPortTypeCollection =
            myServiceDescription.PortTypes;
         int noOfPortTypes = myServiceDescription.PortTypes.Count;
         Console.WriteLine("\nTotal number of PortTypes: "
            + myServiceDescription.PortTypes.Count);

         // Get the first PortType in the collection.
         PortType myNewPortType = myPortTypeCollection["MathServiceSoap"];
         int index = myPortTypeCollection.IndexOf(myNewPortType);
         Console.WriteLine("The PortType with the name " + myNewPortType.Name
            + " is at index: " + (index+1));

         Console.WriteLine("Removing the PortType: " + myNewPortType.Name);

         // Remove the PortType from the collection.
         myPortTypeCollection.Remove(myNewPortType);
         bool bContains = myPortTypeCollection.Contains(myNewPortType);
         Console.WriteLine("The PortType with the name " + myNewPortType.Name
            + " exists: " + bContains);

         Console.WriteLine("Total number of PortTypes after removing: "
            + myServiceDescription.PortTypes.Count);

         Console.WriteLine("Adding a PortType: " + myNewPortType.Name);

         // Add a new portType from the collection.
         myPortTypeCollection.Add(myNewPortType);

         // Display the number of portTypes after adding a port.
         Console.WriteLine("Total number of PortTypes after "
            + "adding a new port: " + myServiceDescription.PortTypes.Count);

         // List the PortTypes available in the WSDL document.
         foreach(PortType myPortType in myPortTypeCollection)
           Console.WriteLine("The PortType name is: " + myPortType.Name);

         myServiceDescription.Write("MathService_New.wsdl");
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception: " + e.Message);
      }
   }
}
Imports System.Web.Services.Description
Imports System.Xml
Imports System.Collections

Class MyPortTypeCollectionClass
   Public Shared Sub Main()
      Try
         ' Read the existing Web service description file.
         Dim myServiceDescription As ServiceDescription = _
            ServiceDescription.Read("MathService_vb.wsdl")
         Dim myPortTypeCollection As PortTypeCollection = _
            myServiceDescription.PortTypes
         Dim noOfPortTypes As Integer = _
            myServiceDescription.PortTypes.Count
         Console.WriteLine( _
            ControlChars.Newline & "Total number of PortTypes: " & _
            myServiceDescription.PortTypes.Count.ToString())

         ' Get the first PortType in the collection.
         Dim myNewPortType As PortType = _
            myPortTypeCollection("MathServiceSoap")
         Dim index As Integer = myPortTypeCollection.IndexOf(myNewPortType)
         Console.WriteLine("The PortType with the name " & _
            myNewPortType.Name & " is at index: " & (index + 1).ToString())

         Console.WriteLine("Removing the PortType: " & myNewPortType.Name)

         ' Remove the PortType from the collection.
         myPortTypeCollection.Remove(myNewPortType)
         Dim bContains As Boolean = _
            myPortTypeCollection.Contains(myNewPortType)
         Console.WriteLine("The PortType with the Name " & _
            myNewPortType.Name & " exists: " & bContains.ToString())

         Console.WriteLine("Total Number of PortTypes after removing: " & _
            myServiceDescription.PortTypes.Count.ToString())

         Console.WriteLine("Adding a PortType: " & myNewPortType.Name)

         ' Add a new portType from the collection.
         myPortTypeCollection.Add(myNewPortType)

         ' Display the number of portTypes after adding a port.
         Console.WriteLine( _
            "Total Number of PortTypes after adding a new port: " & _
            myServiceDescription.PortTypes.Count.ToString())

         ' List the PortTypes available in the WSDL document.
         Dim myPortType As PortType
         For Each myPortType In  myPortTypeCollection
            Console.WriteLine("The PortType name is: " & myPortType.Name)
         Next myPortType
         myServiceDescription.Write("MathService_New.wsdl")
      Catch e As Exception
         Console.WriteLine("Exception: " & e.Message)
      End Try
   End Sub
End Class

Eigenschaften

Capacity

Ruft die Anzahl der Elemente ab, die die CollectionBase enthalten kann, oder legt diese fest.

(Geerbt von CollectionBase)
Count

Ruft die Anzahl der in der CollectionBase-Instanz enthaltenen Elemente ab. Diese Eigenschaft kann nicht überschrieben werden.

(Geerbt von CollectionBase)
InnerList

Ruft eine ArrayList mit der Liste der Elemente in der CollectionBase-Instanz ab.

(Geerbt von CollectionBase)
Item[Int32]

Ruft den Wert eines PortType am angegebenen nullbasierten Index ab oder legt diesen fest.

Item[String]

Ruft den durch den Namen angegebenen PortType ab.

List

Ruft eine IList mit der Liste der Elemente in der CollectionBase-Instanz ab.

(Geerbt von CollectionBase)
Table

Ruft eine Schnittstelle ab, die die Zuordnung der Schlüssel und Werte in der ServiceDescriptionBaseCollection implementiert.

(Geerbt von ServiceDescriptionBaseCollection)

Methoden

Add(PortType)

Fügt am Ende der PortType die angegebene PortTypeCollection hinzu.

Clear()

Entfernt alle Objekte aus der CollectionBase-Instanz. Diese Methode kann nicht überschrieben werden.

(Geerbt von CollectionBase)
Contains(PortType)

Gibt einen Wert zurück, der angibt, ob die angegebene PortType ein Member der PortTypeCollection ist.

CopyTo(PortType[], Int32)

Kopiert die gesamte PortTypeCollection in ein eindimensionales Array vom Typ PortType, wobei am angegebenen nullbasierten Index des Zielarrays begonnen wird.

Equals(Object)

Bestimmt, ob das angegebene Objekt gleich dem aktuellen Objekt ist.

(Geerbt von Object)
GetEnumerator()

Gibt einen Enumerator zurück, der die CollectionBase durchläuft.

(Geerbt von CollectionBase)
GetHashCode()

Fungiert als Standardhashfunktion.

(Geerbt von Object)
GetKey(Object)

Gibt den Namen des Schlüssels zurück, der dem als Verweis übergebenen Wert zugeordnet ist.

(Geerbt von ServiceDescriptionBaseCollection)
GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
IndexOf(PortType)

Sucht nach der angegebenen PortType und gibt den nullbasierten Index des ersten Vorkommens in der Auflistung zurück.

Insert(Int32, PortType)

Fügt der PortType die angegebene PortTypeCollection am angegebenen nullbasierten Index hinzu.

MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
OnClear()

Löscht den Inhalt der ServiceDescriptionBaseCollection-Instanz.

(Geerbt von ServiceDescriptionBaseCollection)
OnClearComplete()

Führt nach dem Löschen des Inhalts der CollectionBase-Instanz zusätzliche benutzerdefinierte Prozesse aus.

(Geerbt von CollectionBase)
OnInsert(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse vor dem Einfügen eines neuen Elements in die CollectionBase-Instanz aus.

(Geerbt von CollectionBase)
OnInsertComplete(Int32, Object)

Führt nach dem Einfügen eines neuen Elements in die ServiceDescriptionBaseCollection zusätzliche benutzerdefinierte Prozesse aus.

(Geerbt von ServiceDescriptionBaseCollection)
OnRemove(Int32, Object)

Entfernt ein Element aus der ServiceDescriptionBaseCollection.

(Geerbt von ServiceDescriptionBaseCollection)
OnRemoveComplete(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse nach dem Entfernen eines Elements aus der CollectionBase-Instanz aus.

(Geerbt von CollectionBase)
OnSet(Int32, Object, Object)

Ersetzt in der ServiceDescriptionBaseCollection einen Wert durch einen anderen.

(Geerbt von ServiceDescriptionBaseCollection)
OnSetComplete(Int32, Object, Object)

Führt zusätzliche benutzerdefinierte Prozesse nach dem Festlegen eines Werts in der CollectionBase-Instanz aus.

(Geerbt von CollectionBase)
OnValidate(Object)

Führt zusätzliche benutzerdefinierte Prozesse beim Validieren eines Werts aus.

(Geerbt von CollectionBase)
Remove(PortType)

Entfernt das erste Vorkommen der angegebenen PortType aus der PortTypeCollection.

RemoveAt(Int32)

Entfernt das Element am angegebenen Index aus der CollectionBase-Instanz. Diese Methode kann nicht überschrieben werden.

(Geerbt von CollectionBase)
SetParent(Object, Object)

Legt das übergeordnete Objekt der ServiceDescriptionBaseCollection-Instanz fest.

(Geerbt von ServiceDescriptionBaseCollection)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Explizite Schnittstellenimplementierungen

ICollection.CopyTo(Array, Int32)

Kopiert die gesamte CollectionBase-Instanz in ein kompatibles eindimensionales Array, beginnend am angegebenen Index des Zielarrays.

(Geerbt von CollectionBase)
ICollection.IsSynchronized

Ruft einen Wert ab, der angibt, ob der Zugriff auf die CollectionBase synchronisiert (threadsicher) ist.

(Geerbt von CollectionBase)
ICollection.SyncRoot

Ruft ein Objekt ab, mit dem der Zugriff auf CollectionBase synchronisiert werden kann.

(Geerbt von CollectionBase)
IList.Add(Object)

Fügt am Ende der CollectionBase ein Objekt hinzu.

(Geerbt von CollectionBase)
IList.Contains(Object)

Ermittelt, ob CollectionBase ein bestimmtes Element enthält.

(Geerbt von CollectionBase)
IList.IndexOf(Object)

Sucht nach dem angegebenen Object und gibt den nullbasierten Index des ersten Vorkommens innerhalb der gesamten CollectionBase zurück.

(Geerbt von CollectionBase)
IList.Insert(Int32, Object)

Fügt am angegebenen Index ein Element in die CollectionBase ein.

(Geerbt von CollectionBase)
IList.IsFixedSize

Ruft einen Wert ab, der angibt, ob das CollectionBase eine feste Größe aufweist.

(Geerbt von CollectionBase)
IList.IsReadOnly

Ruft einen Wert ab, der angibt, ob das CollectionBase schreibgeschützt ist.

(Geerbt von CollectionBase)
IList.Item[Int32]

Ruft das Element am angegebenen Index ab oder legt dieses fest.

(Geerbt von CollectionBase)
IList.Remove(Object)

Entfernt das erste Vorkommen eines angegebenen Objekts aus der CollectionBase.

(Geerbt von CollectionBase)

Erweiterungsmethoden

Cast<TResult>(IEnumerable)

Wandelt die Elemente eines IEnumerable in den angegebenen Typ um

OfType<TResult>(IEnumerable)

Filtert die Elemente eines IEnumerable anhand eines angegebenen Typs

AsParallel(IEnumerable)

Ermöglicht die Parallelisierung einer Abfrage.

AsQueryable(IEnumerable)

Konvertiert einen IEnumerable in einen IQueryable.

Gilt für: