ServiceDescriptionFormatExtensionCollection Clase
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Representa la colección de elementos de extensibilidad utilizados por el servicio web XML. 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
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 conoce de antemano el tipo de elemento de extensibilidad que desea realizar. Use un XmlElement objeto cuando no conozca el formato de un elemento de antemano.
Constructores
| Nombre | Description |
|---|---|
| ServiceDescriptionFormatExtensionCollection(Object) |
Inicializa una nueva instancia de la clase ServiceDescriptionFormatExtensionCollection. |
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 un miembro de .ServiceDescriptionFormatExtensionCollection |
| 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(Object) |
Agrega el objeto especificado ServiceDescriptionFormatExtension al final de .ServiceDescriptionFormatExtensionCollection |
| Clear() |
Quita todos los objetos de la CollectionBase instancia. Este método no se puede invalidar. (Heredado de CollectionBase) |
| Contains(Object) |
Devuelve un valor que indica si el objeto especificado ServiceDescriptionFormatExtension es miembro de .ServiceDescriptionFormatExtensionCollection |
| CopyTo(Object[], Int32) |
Copia todo ServiceDescriptionFormatExtensionCollection en una matriz unidimensional de tipo ServiceDescriptionFormatExtension, comenzando en 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) |
| Find(String, String) |
ServiceDescriptionFormatExtensionCollection Busca un miembro con el nombre y el URI de espacio de nombres especificados. |
| Find(Type) |
Busca en ServiceDescriptionFormatExtensionCollection y devuelve el primer elemento del objeto derivado Typeespecificado. |
| FindAll(String, String) |
ServiceDescriptionFormatExtensionCollection Busca en y devuelve una matriz de todos los miembros con el nombre y el URI de espacio de nombres especificados. |
| FindAll(Type) |
Busca en ServiceDescriptionFormatExtensionCollection y devuelve una matriz de todos los elementos del especificado Type. |
| 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(Object) |
Busca el especificado ServiceDescriptionFormatExtension y devuelve el índice de base cero de la primera instancia con la colección. |
| Insert(Int32, Object) |
Agrega el objeto especificado ServiceDescriptionFormatExtension al ServiceDescriptionFormatExtensionCollection objeto en el índice de base cero especificado. |
| IsHandled(Object) |
Devuelve un valor que indica si el proceso de importación usa el objeto especificado cuando el elemento de extensibilidad se importa en el servicio web XML. |
| IsRequired(Object) |
Devuelve un valor que indica si el objeto especificado es necesario para el funcionamiento del servicio web XML. |
| 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(Object) |
Quita la primera aparición del especificado ServiceDescriptionFormatExtension de .ServiceDescriptionFormatExtensionCollection |
| 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. |