ServiceDescriptionFormatExtensionCollection Clase

Definición

Representa la colección de elementos de extensibilidad que el servicio web XML usa. Esta clase no puede heredarse.

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

Ejemplos

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

using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;

ref class MyFormatExtension: public ServiceDescriptionFormatExtension
{
public:
   MyFormatExtension()
   {
      // Set the properties.
      this->Handled = true;
      this->Required = true;
   }
};

int main()
{
   try
   {
      ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Sample_cpp.wsdl" );
      ServiceDescriptionFormatExtensionCollection^ myCollection = gcnew ServiceDescriptionFormatExtensionCollection( myServiceDescription );

      SoapBinding^ mySoapBinding1 = gcnew SoapBinding;
      SoapBinding^ mySoapBinding2 = gcnew SoapBinding;
      SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding;
      MyFormatExtension^ myFormatExtensionObject = gcnew MyFormatExtension;

      // Add elements to collection.
      myCollection->Add( mySoapBinding1 );
      myCollection->Add( mySoapAddressBinding );
      myCollection->Add( mySoapBinding2 );
      myCollection->Add( myFormatExtensionObject );

      Console::WriteLine( "Collection contains following types of elements: " );
      
      // Display the 'Type' of the elements in collection.
      for ( int i = 0; i < myCollection->Count; i++ )
         Console::WriteLine( myCollection[ i ]->GetType() );

      // Check element of type 'SoapAddressBinding' in collection.
      Object^ myObj = myCollection->Find( mySoapAddressBinding->GetType() );
      if ( myObj == nullptr )
            Console::WriteLine( "Element of type ' {0}' not found in collection.", mySoapAddressBinding->GetType() );
      else
            Console::WriteLine( "Element of type ' {0}' found in collection.", mySoapAddressBinding->GetType() );

      // Check all elements of type 'SoapBinding' in collection.
      array<Object^>^myObjectArray1 = gcnew array<Object^>(myCollection->Count);
      myObjectArray1 = myCollection->FindAll( mySoapBinding1->GetType() );
      int myNumberOfElements = 0;
      IEnumerator^ myIEnumerator = myObjectArray1->GetEnumerator();

      // Calculate number of elements of type 'SoapBinding'.
      while ( myIEnumerator->MoveNext() )
            if ( mySoapBinding1->GetType() == myIEnumerator->Current->GetType() )
            myNumberOfElements++;
      Console::WriteLine( "Collection contains {0} objects of type ' {1}'.", myNumberOfElements, mySoapBinding1->GetType() );

      // Check 'IsHandled' status for 'myFormatExtensionObject' object in collection.
      Console::WriteLine( "'IsHandled' status for {0} object is {1}.", myFormatExtensionObject, myCollection->IsHandled( myFormatExtensionObject ) );

      // Check 'IsRequired' status for 'myFormatExtensionObject' object in collection.
      Console::WriteLine( "'IsRequired' status for {0} object is {1}.", myFormatExtensionObject, myCollection->IsRequired( myFormatExtensionObject ) );

      // Copy elements of collection to an Object array.
      array<Object^>^myObjectArray2 = gcnew array<Object^>(myCollection->Count);
      myCollection->CopyTo( myObjectArray2, 0 );
      Console::WriteLine( "Collection elements are copied to an object array." );

      // Check for 'myFormatExtension' object in collection.
      if ( myCollection->Contains( myFormatExtensionObject ) )
      {
         // Get index of a 'myFormatExtension' object in collection.
         Console::WriteLine( "Index of 'myFormatExtensionObject' is {0} in collection.", myCollection->IndexOf( myFormatExtensionObject ) );

         // Remove 'myFormatExtensionObject' element from collection.
         myCollection->Remove( myFormatExtensionObject );
         Console::WriteLine( "'myFormatExtensionObject' is removed  from collection." );
      }

      // Insert 'MyFormatExtension' object.
      myCollection->Insert( 0, myFormatExtensionObject );
      Console::WriteLine( "'myFormatExtensionObject' is inserted to collection." );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "The following exception was raised: {0}", e->Message );
   }
}
using System;
using System.Web.Services.Description;
using System.Collections;

class MyFormatExtension : ServiceDescriptionFormatExtension
{
   public MyFormatExtension()
   {
      // Set the properties.
      this.Handled  = true;
      this.Required = true;
   }
}
class myCollectionSample
{
   static void Main()
   {
      try
      {
         ServiceDescription myServiceDescription =
            ServiceDescription.Read("Sample_CS.wsdl");
         ServiceDescriptionFormatExtensionCollection  myCollection =
            new ServiceDescriptionFormatExtensionCollection(myServiceDescription);
         SoapBinding mySoapBinding1 = new SoapBinding();
         SoapBinding mySoapBinding2 = new SoapBinding();
         SoapAddressBinding mySoapAddressBinding = new SoapAddressBinding();
         MyFormatExtension  myFormatExtensionObject = new MyFormatExtension();
         // Add elements to collection.
         myCollection.Add(mySoapBinding1);
         myCollection.Add(mySoapAddressBinding);
         myCollection.Add(mySoapBinding2);
         myCollection.Add(myFormatExtensionObject);
         Console.WriteLine("Collection contains following types of elements: ");
         // Display the 'Type' of the elements in collection.
         for(int i = 0;i< myCollection.Count;i++)
         {
            Console.WriteLine(myCollection[i].GetType().ToString());
         }
         // Check element of type 'SoapAddressBinding' in collection.
         Object   myObj = myCollection.Find(mySoapAddressBinding.GetType());
         if(myObj == null)
         {
            Console.WriteLine("Element of type '{0}' not found in collection.",
               mySoapAddressBinding.GetType().ToString());
         }
         else
         {
            Console.WriteLine("Element of type '{0}' found in collection.",
               mySoapAddressBinding.GetType().ToString());
         }
         // Check all elements of type 'SoapBinding' in collection.
         Object[] myObjectArray1 = new Object[myCollection.Count];
         myObjectArray1 = myCollection.FindAll(mySoapBinding1.GetType());
         int myNumberOfElements = 0;
         IEnumerator myIEnumerator  = myObjectArray1.GetEnumerator();

         // Calculate number of elements of type 'SoapBinding'.
         while(myIEnumerator.MoveNext())
         {
            if(mySoapBinding1.GetType() == myIEnumerator.Current.GetType())
               myNumberOfElements++;
         }
         Console.WriteLine("Collection contains {0} objects of type '{1}'.",
                           myNumberOfElements.ToString(),
                           mySoapBinding1.GetType().ToString());
         // Check 'IsHandled' status for 'myFormatExtensionObject' object in collection.
         Console.WriteLine("'IsHandled' status for {0} object is {1}.",
                  myFormatExtensionObject.ToString(),
                  myCollection.IsHandled(myFormatExtensionObject).ToString());
         // Check 'IsRequired' status for 'myFormatExtensionObject' object in collection.
         Console.WriteLine("'IsRequired' status for {0} object is {1}.",
                  myFormatExtensionObject.ToString(),
                  myCollection.IsRequired(myFormatExtensionObject).ToString());
         // Copy elements of collection to an Object array.
         Object[] myObjectArray2 = new Object[myCollection.Count];
         myCollection.CopyTo(myObjectArray2,0);
         Console.WriteLine("Collection elements are copied to an object array.");
         // Check for 'myFormatExtension' object in collection.
         if(myCollection.Contains(myFormatExtensionObject))
         {
            // Get index of a 'myFormatExtension' object in collection.
            Console.WriteLine("Index of 'myFormatExtensionObject' is "+
               "{0} in collection.",
               myCollection.IndexOf(myFormatExtensionObject).ToString());
            // Remove 'myFormatExtensionObject' element from collection.
            myCollection.Remove(myFormatExtensionObject);
            Console.WriteLine("'myFormatExtensionObject' is removed"+
                              " from collection.");
         }
         // Insert 'MyFormatExtension' object.
         myCollection.Insert(0,myFormatExtensionObject);
         Console.WriteLine("'myFormatExtensionObject' is inserted to collection.");
      }
      catch(Exception e)
      {
         Console.WriteLine("The following exception was raised: {0}", e.Message);
      }
   }
}
Imports System.Web.Services.Description
Imports System.Collections


Class MyFormatExtension
   Inherits ServiceDescriptionFormatExtension
   
   Public Sub New()
      ' Set the properties.
      Me.Handled = True
      Me.Required = True
   End Sub
End Class

Class myCollectionSample
   
   Shared Sub Main()
      Try
         Dim myServiceDescription As ServiceDescription = _
                 ServiceDescription.Read("Sample_VB.wsdl")
         Dim myCollection As New ServiceDescriptionFormatExtensionCollection(myServiceDescription)
         Dim mySoapBinding1 As New SoapBinding()
         Dim mySoapBinding2 As New SoapBinding()
         Dim mySoapAddressBinding As New SoapAddressBinding()
         Dim myFormatExtensionObject As New MyFormatExtension()
         ' Add elements to collection.
         myCollection.Add(mySoapBinding1)
         myCollection.Add(mySoapAddressBinding)
         myCollection.Add(mySoapBinding2)
         myCollection.Add(myFormatExtensionObject)
         Console.WriteLine("Collection contains following types of elements: ")
         ' Display the 'Type' of the elements in collection.
         Dim i As Integer
         For i = 0 To myCollection.Count - 1
            Console.WriteLine(myCollection(i).GetType().ToString())
         Next i
         ' Check element of type 'SoapAddressBinding' in collection.
         Dim myObj As Object = myCollection.Find(mySoapAddressBinding.GetType())
         If myObj Is Nothing Then
            Console.WriteLine("Element of type '{0}' not found in collection.", _
                 mySoapAddressBinding.GetType().ToString())
         Else
            Console.WriteLine("Element of type '{0}' found in collection.", _
                 mySoapAddressBinding.GetType().ToString())
         End If
         ' Check all elements of type 'SoapBinding' in collection.
         Dim myObjectArray1(myCollection.Count -1 ) As Object
         myObjectArray1 = myCollection.FindAll(mySoapBinding1.GetType())
         Dim myNumberOfElements As Integer = 0
         Dim myIEnumerator As IEnumerator = myObjectArray1.GetEnumerator()
         
         ' Calculate number of elements of type 'SoapBinding'.
         While myIEnumerator.MoveNext()
            If mySoapBinding1.GetType() Is  myIEnumerator.Current.GetType() Then
               myNumberOfElements += 1
            End If
         End While
         Console.WriteLine("Collection contains {0} objects of type '{1}'.", _
                 myNumberOfElements.ToString(), mySoapBinding1.GetType().ToString())
         ' Check 'IsHandled' status for 'myFormatExtensionObject' object in collection.
         Console.WriteLine("'IsHandled' status for {0} object is {1}.", _
                 myFormatExtensionObject.ToString(), _
                 myCollection.IsHandled(myFormatExtensionObject).ToString())
         ' Check 'IsRequired' status for 'myFormatExtensionObject' object in collection.
         Console.WriteLine("'IsRequired' status for {0} object is {1}.", _
                 myFormatExtensionObject.ToString(), _
                 myCollection.IsRequired(myFormatExtensionObject).ToString())
         ' Copy elements of collection to an Object array.
         Dim myObjectArray2(myCollection.Count -1 ) As Object
         myCollection.CopyTo(myObjectArray2, 0)
         Console.WriteLine("Collection elements are copied to an object array.")
         ' Check for 'myFormatExtension' object in collection.
         If myCollection.Contains(myFormatExtensionObject) Then
            ' Get index of a 'myFormatExtension' object in collection.
            Console.WriteLine("Index of 'myFormatExtensionObject' is " + _
                 "{0} in collection.", myCollection.IndexOf(myFormatExtensionObject).ToString())
            ' Remove 'myFormatExtensionObject' element from collection.
            myCollection.Remove(myFormatExtensionObject)
            Console.WriteLine("'myFormatExtensionObject' is removed" + _
                 " from collection.")
         End If
         ' Insert 'MyFormatExtension' object.
         myCollection.Insert(0, myFormatExtensionObject)
         Console.WriteLine("'myFormatExtensionObject' is inserted to collection.")
      Catch e As Exception
         Console.WriteLine("The following exception was raised: {0}", e.Message.ToString())
      End Try
   End Sub
End Class

Comentarios

Esta colección puede contener instancias de clases derivadas de ServiceDescriptionFormatExtension, o instancias de la XmlElement clase . En una clase derivada, ServiceDescriptionFormatExtension la clase permite a los usuarios definir elementos de extensibilidad además de los definidos en la especificación del Lenguaje de descripción de servicios web (WSDL). Úselos en su ServiceDescriptionFormatExtensionCollection si sabe de antemano el tipo de elemento de extensibilidad que desea crear. Use un valor XmlElement cuando no conozca el formato de un elemento de antemano.

Constructores

ServiceDescriptionFormatExtensionCollection(Object)

Inicializa una nueva instancia de la clase ServiceDescriptionFormatExtensionCollection.

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 un miembro de ServiceDescriptionFormatExtensionCollection.

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(Object)

Agrega el objeto ServiceDescriptionFormatExtension especificado al final de ServiceDescriptionFormatExtensionCollection.

Clear()

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

(Heredado de CollectionBase)
Contains(Object)

Devuelve un valor que indica si el objeto ServiceDescriptionFormatExtension especificado es un miembro del objeto ServiceDescriptionFormatExtensionCollection.

CopyTo(Object[], Int32)

Copia todo el objeto ServiceDescriptionFormatExtensionCollection en una matriz unidimensional de tipo ServiceDescriptionFormatExtension, 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)
Find(String, String)

Busca en ServiceDescriptionFormatExtensionCollection un miembro con el nombre y el identificador URI del espacio de nombres especificados.

Find(Type)

Busca ServiceDescriptionFormatExtensionCollection y devuelve el primer elemento del objeto Type derivado especificado.

FindAll(String, String)

Busca ServiceDescriptionFormatExtensionCollection y devuelve una matriz de todos los miembros con el nombre y el identificador URI del espacio de nombres especificados.

FindAll(Type)

Busca ServiceDescriptionFormatExtensionCollection y devuelve una matriz de todos los elementos del Type especificado.

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(Object)

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

Insert(Int32, Object)

Agrega el objeto ServiceDescriptionFormatExtension especificado al objeto ServiceDescriptionFormatExtensionCollection en el índice de base cero especificado.

IsHandled(Object)

Devuelve un valor que indica si el objeto especificado se utiliza en el proceso de importación cuando se importa el elemento de extensibilidad en el servicio Web XML.

IsRequired(Object)

Devuelve un valor que indica si el objeto especificado es necesario para la operación del servicio Web XML.

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(Object)

Quita la primera aparición del objeto ServiceDescriptionFormatExtension especificado de ServiceDescriptionFormatExtensionCollection.

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