Share via


PortTypeCollection Classe

Definição

Representa uma coleção de instâncias da classe PortType; ou seja, uma coleção de conjuntos de operações compatíveis com o serviço Web XML. Essa classe não pode ser herdada.

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
Herança

Exemplos

#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

Propriedades

Capacity

Obtém ou define o número de elementos que o CollectionBase pode conter.

(Herdado de CollectionBase)
Count

Obtém o número de elementos contidos na instância de CollectionBase. Essa propriedade não pode ser substituída.

(Herdado de CollectionBase)
InnerList

Obtém uma ArrayList que contém a lista de elementos na instância de CollectionBase.

(Herdado de CollectionBase)
Item[Int32]

Obtém ou define o valor de um PortType no índice de base zero especificado.

Item[String]

Obtém o PortType especificado por seu nome.

List

Obtém uma IList que contém a lista de elementos na instância de CollectionBase.

(Herdado de CollectionBase)
Table

Obtém uma interface que implementa a associação das chaves e valores no ServiceDescriptionBaseCollection.

(Herdado de ServiceDescriptionBaseCollection)

Métodos

Add(PortType)

Adiciona o PortType especificado ao final do PortTypeCollection.

Clear()

Remove todos os objetos da instância CollectionBase. Esse método não pode ser substituído.

(Herdado de CollectionBase)
Contains(PortType)

Retorna um valor que indica se o PortType especificado é um membro do PortTypeCollection.

CopyTo(PortType[], Int32)

Copia todo o PortTypeCollection para uma matriz unidimensional do tipo PortType, começando no índice de base zero especificado da matriz de destino.

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.

(Herdado de Object)
GetEnumerator()

Retorna um enumerador que itera pela instância CollectionBase.

(Herdado de CollectionBase)
GetHashCode()

Serve como a função de hash padrão.

(Herdado de Object)
GetKey(Object)

Retorna o nome da chave associada com o valor passado por referência.

(Herdado de ServiceDescriptionBaseCollection)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
IndexOf(PortType)

Pesquisa o PortType especificado e retorna o índice de base zero da primeira ocorrência dentro de toda a coleção.

Insert(Int32, PortType)

Adiciona o PortType especificado ao PortTypeCollection no índice de base zero especificado.

MemberwiseClone()

Cria uma cópia superficial do Object atual.

(Herdado de Object)
OnClear()

Limpa o conteúdo da instância ServiceDescriptionBaseCollection.

(Herdado de ServiceDescriptionBaseCollection)
OnClearComplete()

Executa processos adicionais personalizados após limpar o conteúdo da instância CollectionBase.

(Herdado de CollectionBase)
OnInsert(Int32, Object)

Executa os processos personalizados adicionais antes de inserir um novo elemento na instância CollectionBase.

(Herdado de CollectionBase)
OnInsertComplete(Int32, Object)

Realiza processos personalizados adicionais após inserir um novo elemento no ServiceDescriptionBaseCollection.

(Herdado de ServiceDescriptionBaseCollection)
OnRemove(Int32, Object)

Remove um elemento do ServiceDescriptionBaseCollection.

(Herdado de ServiceDescriptionBaseCollection)
OnRemoveComplete(Int32, Object)

Executa processos personalizados adicionais após remover um elemento da instância de CollectionBase.

(Herdado de CollectionBase)
OnSet(Int32, Object, Object)

Substitui um valor por outro dentro do ServiceDescriptionBaseCollection.

(Herdado de ServiceDescriptionBaseCollection)
OnSetComplete(Int32, Object, Object)

Executa processos personalizados adicionais após configurar um valor na instância de CollectionBase.

(Herdado de CollectionBase)
OnValidate(Object)

Executa processos personalizados adicionais ao validar um valor.

(Herdado de CollectionBase)
Remove(PortType)

Remove a primeira ocorrência do PortType especificado do PortTypeCollection.

RemoveAt(Int32)

Remove o elemento no índice especificado da instância CollectionBase. Este método não é substituível.

(Herdado de CollectionBase)
SetParent(Object, Object)

Define o objeto pai da instância de ServiceDescriptionBaseCollection.

(Herdado de ServiceDescriptionBaseCollection)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.

(Herdado de Object)

Implantações explícitas de interface

ICollection.CopyTo(Array, Int32)

Copia todo o CollectionBase em um Array unidimensional compatível, começando no índice especificado da matriz de destino.

(Herdado de CollectionBase)
ICollection.IsSynchronized

Obtém um valor que indica se o acesso à CollectionBase é sincronizado (thread-safe).

(Herdado de CollectionBase)
ICollection.SyncRoot

Obtém um objeto que pode ser usado para sincronizar o acesso ao CollectionBase.

(Herdado de CollectionBase)
IList.Add(Object)

Adiciona um objeto ao final do CollectionBase.

(Herdado de CollectionBase)
IList.Contains(Object)

Determina se o CollectionBase contém um elemento específico.

(Herdado de CollectionBase)
IList.IndexOf(Object)

Pesquisa o Object especificado e retorna o índice de base zero da primeira ocorrência dentro de todo o CollectionBase.

(Herdado de CollectionBase)
IList.Insert(Int32, Object)

Insere um elemento no CollectionBase, no índice especificado.

(Herdado de CollectionBase)
IList.IsFixedSize

Obtém um valor que indica se o CollectionBase tem um tamanho fixo.

(Herdado de CollectionBase)
IList.IsReadOnly

Obtém um valor que indica se o CollectionBase é somente leitura.

(Herdado de CollectionBase)
IList.Item[Int32]

Obtém ou define o elemento no índice especificado.

(Herdado de CollectionBase)
IList.Remove(Object)

Remove a primeira ocorrência de um objeto específico do CollectionBase.

(Herdado de CollectionBase)

Métodos de Extensão

Cast<TResult>(IEnumerable)

Converte os elementos de um IEnumerable para o tipo especificado.

OfType<TResult>(IEnumerable)

Filtra os elementos de um IEnumerable com base em um tipo especificado.

AsParallel(IEnumerable)

Habilita a paralelização de uma consulta.

AsQueryable(IEnumerable)

Converte um IEnumerable em um IQueryable.

Aplica-se a