PortTypeCollection Clase

Definición

Representa una colección de instancias de la clase PortType; es decir, una colección de conjuntos de operaciones admitidas por el servicio web XML. Esta clase no puede heredarse.

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
Herencia

Ejemplos

#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

Propiedades

Capacity

Obtiene o establece el número de elementos que puede contener CollectionBase.

(Heredado de CollectionBase)
Count

Obtiene el número de elementos contenidos en la instancia de CollectionBase. Esta propiedad no se puede invalidar.

(Heredado de CollectionBase)
InnerList

Obtiene una colección ArrayList que contiene la lista de elementos incluidos en la instancia de CollectionBase.

(Heredado de CollectionBase)
Item[Int32]

Obtiene o establece el valor de PortType en el índice de base cero especificado.

Item[String]

Obtiene el PortType especificado por su nombre.

List

Obtiene una colección IList que contiene la lista de elementos incluidos en la instancia de CollectionBase.

(Heredado de CollectionBase)
Table

Obtiene una interfaz que implementa la asociación de las claves y los valores de ServiceDescriptionBaseCollection.

(Heredado de ServiceDescriptionBaseCollection)

Métodos

Add(PortType)

Agrega el objeto PortType especificado al final de PortTypeCollection.

Clear()

Elimina todos los objetos de la instancia de CollectionBase. Este método no se puede invalidar.

(Heredado de CollectionBase)
Contains(PortType)

Devuelve un valor que indica si el objeto PortType especificado es un miembro del objeto PortTypeCollection.

CopyTo(PortType[], Int32)

Copia todo el objeto PortTypeCollection en una matriz unidimensional de tipo PortType, a partir del índice de base cero especificado de la matriz de destino.

Equals(Object)

Determina si el objeto especificado es igual que el objeto actual.

(Heredado de Object)
GetEnumerator()

Devuelve un enumerador que recorre en iteración la instancia de CollectionBase.

(Heredado de CollectionBase)
GetHashCode()

Sirve como la función hash predeterminada.

(Heredado de Object)
GetKey(Object)

Devuelve el nombre de la clave asociada al valor pasado por referencia.

(Heredado de ServiceDescriptionBaseCollection)
GetType()

Obtiene el Type de la instancia actual.

(Heredado de Object)
IndexOf(PortType)

Busca el objeto PortType especificado y devuelve el índice de base cero de la primera aparición encontrada en la colección.

Insert(Int32, PortType)

Agrega el objeto PortType especificado al objeto PortTypeCollection en el índice de base cero especificado.

MemberwiseClone()

Crea una copia superficial del Object actual.

(Heredado de Object)
OnClear()

Borra el contenido de la instancia de ServiceDescriptionBaseCollection.

(Heredado de ServiceDescriptionBaseCollection)
OnClearComplete()

Realiza procesos personalizados adicionales después de borrar el contenido de la instancia de CollectionBase.

(Heredado de CollectionBase)
OnInsert(Int32, Object)

Realiza procesos personalizados adicionales antes de insertar un nuevo elemento en la instancia de CollectionBase.

(Heredado de CollectionBase)
OnInsertComplete(Int32, Object)

Realiza procesos de personalización adicionales al insertar un nuevo elemento en ServiceDescriptionBaseCollection.

(Heredado de ServiceDescriptionBaseCollection)
OnRemove(Int32, Object)

Quita un elemento de ServiceDescriptionBaseCollection.

(Heredado de ServiceDescriptionBaseCollection)
OnRemoveComplete(Int32, Object)

Realiza procesos personalizados adicionales después de quitar un elemento de la instancia de CollectionBase.

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

Reemplaza un valor por otro incluido en ServiceDescriptionBaseCollection.

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

Realiza procesos personalizados adicionales después de establecer un valor en la instancia de CollectionBase.

(Heredado de CollectionBase)
OnValidate(Object)

Realiza procesos de personalización adicionales al validar un valor.

(Heredado de CollectionBase)
Remove(PortType)

Quita la primera aparición del objeto PortType especificado de PortTypeCollection.

RemoveAt(Int32)

Quita el elemento que se encuentra en el índice especificado de la instancia de CollectionBase. Este método no se puede reemplazar.

(Heredado de CollectionBase)
SetParent(Object, Object)

Establece el objeto primario de la instancia de ServiceDescriptionBaseCollection.

(Heredado de ServiceDescriptionBaseCollection)
ToString()

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Implementaciones de interfaz explícitas

ICollection.CopyTo(Array, Int32)

Copia la totalidad de CollectionBase en una matriz Array unidimensional compatible, comenzando en el índice especificado de la matriz de destino.

(Heredado de CollectionBase)
ICollection.IsSynchronized

Obtiene un valor que indica si el acceso a la interfaz CollectionBase está sincronizado (es seguro para subprocesos).

(Heredado de CollectionBase)
ICollection.SyncRoot

Obtiene un objeto que se puede usar para sincronizar el acceso a CollectionBase.

(Heredado de CollectionBase)
IList.Add(Object)

Agrega un objeto al final de CollectionBase.

(Heredado de CollectionBase)
IList.Contains(Object)

Determina si CollectionBase contiene un elemento específico.

(Heredado de CollectionBase)
IList.IndexOf(Object)

Busca el objeto Object especificado y devuelve el índice de base cero de la primera aparición en toda la colección CollectionBase.

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

Inserta un elemento en CollectionBase en el índice especificado.

(Heredado de CollectionBase)
IList.IsFixedSize

Obtiene un valor que indica si la interfaz CollectionBase tiene un tamaño fijo.

(Heredado de CollectionBase)
IList.IsReadOnly

Obtiene un valor que indica si CollectionBase es de solo lectura.

(Heredado de CollectionBase)
IList.Item[Int32]

Obtiene o establece el elemento en el índice especificado.

(Heredado de CollectionBase)
IList.Remove(Object)

Quita la primera aparición de un objeto específico de la interfaz CollectionBase.

(Heredado de CollectionBase)

Métodos de extensión

Cast<TResult>(IEnumerable)

Convierte los elementos de IEnumerable en el tipo especificado.

OfType<TResult>(IEnumerable)

Filtra los elementos de IEnumerable en función de un tipo especificado.

AsParallel(IEnumerable)

Habilita la paralelización de una consulta.

AsQueryable(IEnumerable)

Convierte una interfaz IEnumerable en IQueryable.

Se aplica a