PortTypeCollection Klasa

Definicja

Reprezentuje kolekcję wystąpień klasy, czyli kolekcję zestawów PortType operacji obsługiwanych przez usługę sieci Web XML. Klasa ta nie może być dziedziczona.

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
Dziedziczenie

Przykłady

#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

Właściwości

Capacity

Pobiera lub ustawia liczbę elementów, które CollectionBase mogą zawierać.

(Odziedziczone po CollectionBase)
Count

Pobiera liczbę elementów zawartych w wystąpieniu CollectionBase . Nie można zastąpić tej właściwości.

(Odziedziczone po CollectionBase)
InnerList

Pobiera element ArrayList zawierający listę elementów w wystąpieniu CollectionBase .

(Odziedziczone po CollectionBase)
Item[Int32]

Pobiera lub ustawia wartość PortType określonego indeksu opartego na zerach.

Item[String]

Pobiera określony PortType przez jego nazwę.

List

Pobiera element IList zawierający listę elementów w wystąpieniu CollectionBase .

(Odziedziczone po CollectionBase)
Table

Pobiera interfejs implementujący skojarzenie kluczy i wartości w obiekcie ServiceDescriptionBaseCollection.

(Odziedziczone po ServiceDescriptionBaseCollection)

Metody

Add(PortType)

Dodaje określony PortType element na końcu elementu PortTypeCollection.

Clear()

Usuwa wszystkie obiekty z CollectionBase wystąpienia. Nie można zastąpić tej metody.

(Odziedziczone po CollectionBase)
Contains(PortType)

Zwraca wartość wskazującą, czy określony PortType element jest elementem członkowskim elementu PortTypeCollection.

CopyTo(PortType[], Int32)

Kopiuje całą PortTypeCollection do jednowymiarowej tablicy typu PortType, zaczynając od określonego indeksu zerowego tablicy docelowej.

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetEnumerator()

Zwraca moduł wyliczający, który iteruje za pośrednictwem CollectionBase wystąpienia.

(Odziedziczone po CollectionBase)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetKey(Object)

Zwraca nazwę klucza skojarzonego z wartością przekazaną przez odwołanie.

(Odziedziczone po ServiceDescriptionBaseCollection)
GetType()

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
IndexOf(PortType)

Wyszukuje określony PortType element i zwraca indeks zerowy pierwszego wystąpienia w kolekcji.

Insert(Int32, PortType)

Dodaje określony PortType element do określonego PortTypeCollection indeksu opartego na zera.

MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
OnClear()

Czyści zawartość ServiceDescriptionBaseCollection wystąpienia.

(Odziedziczone po ServiceDescriptionBaseCollection)
OnClearComplete()

Wykonuje dodatkowe procesy niestandardowe po wyczyszczeniu zawartości CollectionBase wystąpienia.

(Odziedziczone po CollectionBase)
OnInsert(Int32, Object)

Wykonuje dodatkowe procesy niestandardowe przed wstawieniem nowego elementu do CollectionBase wystąpienia.

(Odziedziczone po CollectionBase)
OnInsertComplete(Int32, Object)

Wykonuje dodatkowe procesy niestandardowe po wstawieniu nowego elementu do elementu ServiceDescriptionBaseCollection.

(Odziedziczone po ServiceDescriptionBaseCollection)
OnRemove(Int32, Object)

Usuwa element z elementu ServiceDescriptionBaseCollection.

(Odziedziczone po ServiceDescriptionBaseCollection)
OnRemoveComplete(Int32, Object)

Wykonuje dodatkowe procesy niestandardowe po usunięciu CollectionBase elementu z wystąpienia.

(Odziedziczone po CollectionBase)
OnSet(Int32, Object, Object)

Zamienia jedną wartość na inną w obiekcie ServiceDescriptionBaseCollection.

(Odziedziczone po ServiceDescriptionBaseCollection)
OnSetComplete(Int32, Object, Object)

Wykonuje dodatkowe procesy niestandardowe po ustawieniu wartości w wystąpieniu CollectionBase .

(Odziedziczone po CollectionBase)
OnValidate(Object)

Wykonuje dodatkowe procesy niestandardowe podczas sprawdzania poprawności wartości.

(Odziedziczone po CollectionBase)
Remove(PortType)

Usuwa pierwsze wystąpienie określonego PortType elementu z elementu PortTypeCollection.

RemoveAt(Int32)

Usuwa element w określonym indeksie CollectionBase wystąpienia. Ta metoda nie jest zastępowana.

(Odziedziczone po CollectionBase)
SetParent(Object, Object)

Ustawia obiekt ServiceDescriptionBaseCollection nadrzędny wystąpienia.

(Odziedziczone po ServiceDescriptionBaseCollection)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Jawne implementacje interfejsu

ICollection.CopyTo(Array, Int32)

Kopiuje całą CollectionBase do zgodnej jednowymiarowej Arraytablicy, zaczynając od określonego indeksu tablicy docelowej.

(Odziedziczone po CollectionBase)
ICollection.IsSynchronized

Pobiera wartość wskazującą, czy dostęp do elementu CollectionBase jest synchronizowany (bezpieczny wątek).

(Odziedziczone po CollectionBase)
ICollection.SyncRoot

Pobiera obiekt, który może służyć do synchronizowania dostępu do obiektu CollectionBase.

(Odziedziczone po CollectionBase)
IList.Add(Object)

Dodaje obiekt na końcu obiektu CollectionBase.

(Odziedziczone po CollectionBase)
IList.Contains(Object)

Określa, czy element CollectionBase zawiera określony element.

(Odziedziczone po CollectionBase)
IList.IndexOf(Object)

Wyszukuje określony Object element i zwraca indeks oparty na zerowym pierwszym wystąpieniu w całym CollectionBaseobiekcie .

(Odziedziczone po CollectionBase)
IList.Insert(Int32, Object)

Wstawia element do CollectionBase określonego indeksu.

(Odziedziczone po CollectionBase)
IList.IsFixedSize

Pobiera wartość wskazującą, czy rozmiar CollectionBase ma stały rozmiar.

(Odziedziczone po CollectionBase)
IList.IsReadOnly

Pobiera wartość wskazującą, czy kolekcja CollectionBase jest przeznaczona tylko do odczytu.

(Odziedziczone po CollectionBase)
IList.Item[Int32]

Pobiera lub ustawia element pod określonym indeksem.

(Odziedziczone po CollectionBase)
IList.Remove(Object)

Usuwa pierwsze wystąpienie określonego obiektu z obiektu CollectionBase.

(Odziedziczone po CollectionBase)

Metody rozszerzania

Cast<TResult>(IEnumerable)

Rzutuje elementy elementu IEnumerable na określony typ.

OfType<TResult>(IEnumerable)

Filtruje elementy elementu IEnumerable na podstawie określonego typu.

AsParallel(IEnumerable)

Umożliwia równoległość zapytania.

AsQueryable(IEnumerable)

Konwertuje element IEnumerable na .IQueryable

Dotyczy