PortTypeCollection Clase

Definición

Representa una colección de instancias de la PortType clase ; es decir, una colección de conjuntos de operaciones compatibles con 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

Nombre Description
Capacity

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

(Heredado de CollectionBase)
Count

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

(Heredado de CollectionBase)
InnerList

Obtiene un ArrayList objeto que contiene la lista de elementos de la CollectionBase instancia de .

(Heredado de CollectionBase)
Item[Int32]

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

Item[String]

Obtiene el PortType objeto especificado por su nombre.

List

Obtiene un IList objeto que contiene la lista de elementos de la CollectionBase instancia de .

(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

Nombre Description
Add(PortType)

Agrega el objeto especificado PortType al final de .PortTypeCollection

Clear()

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

(Heredado de CollectionBase)
Contains(PortType)

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

CopyTo(PortType[], Int32)

Copia todo PortTypeCollection en una matriz unidimensional de tipo PortType, empezando por el índice de base cero especificado de la matriz de destino.

Equals(Object)

Determina si el objeto especificado es igual al objeto actual.

(Heredado de Object)
GetEnumerator()

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

(Heredado de CollectionBase)
GetHashCode()

Actúa como 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 especificado PortType y devuelve el índice de base cero de la primera aparición dentro de la colección.

Insert(Int32, PortType)

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

MemberwiseClone()

Crea una copia superficial del Objectactual.

(Heredado de Object)
OnClear()

Borra el contenido de la ServiceDescriptionBaseCollection instancia.

(Heredado de ServiceDescriptionBaseCollection)
OnClearComplete()

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

(Heredado de CollectionBase)
OnInsert(Int32, Object)

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

(Heredado de CollectionBase)
OnInsertComplete(Int32, Object)

Realiza procesos personalizados adicionales después de 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 CollectionBase instancia.

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

Reemplaza un valor por otro dentro de ServiceDescriptionBaseCollection.

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

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

(Heredado de CollectionBase)
OnValidate(Object)

Realiza procesos personalizados adicionales al validar un valor.

(Heredado de CollectionBase)
Remove(PortType)

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

RemoveAt(Int32)

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

(Heredado de CollectionBase)
SetParent(Object, Object)

Establece el objeto primario de la ServiceDescriptionBaseCollection instancia.

(Heredado de ServiceDescriptionBaseCollection)
ToString()

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Implementaciones de interfaz explícitas

Nombre Description
ICollection.CopyTo(Array, Int32)

Copia todo en CollectionBase una unidimensional Arraycompatible, empezando por el índice especificado de la matriz de destino.

(Heredado de CollectionBase)
ICollection.IsSynchronized

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

(Heredado de CollectionBase)
ICollection.SyncRoot

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

(Heredado de CollectionBase)
IList.Add(Object)

Agrega un objeto al final de .CollectionBase

(Heredado de CollectionBase)
IList.Contains(Object)

Determina si contiene CollectionBase un elemento específico.

(Heredado de CollectionBase)
IList.IndexOf(Object)

Busca el especificado Object y devuelve el índice de base cero de la primera aparición dentro de todo CollectionBase.

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

Inserta un elemento en en el CollectionBase índice especificado.

(Heredado de CollectionBase)
IList.IsFixedSize

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

(Heredado de CollectionBase)
IList.IsReadOnly

Obtiene un valor que indica si es CollectionBase 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 CollectionBase.

(Heredado de CollectionBase)

Métodos de extensión

Nombre Description
AsParallel(IEnumerable)

Habilita la paralelización de una consulta.

AsQueryable(IEnumerable)

Convierte un IEnumerable en un IQueryable.

Cast<TResult>(IEnumerable)

Convierte los elementos de un IEnumerable al tipo especificado.

OfType<TResult>(IEnumerable)

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

Se aplica a