ServiceDescriptionFormatExtensionCollection Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Représente la collection d’éléments d’extensibilité utilisés par le service Web XML. Cette classe ne peut pas être héritée.
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
- Héritage
Exemples
#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
Remarques
Cette collection peut contenir des instances de classes dérivant de ServiceDescriptionFormatExtension, ou des instances de la XmlElement classe. Dans une classe dérivée, ServiceDescriptionFormatExtension la classe permet aux utilisateurs de définir des éléments d’extensibilité en plus de ceux définis dans la spécification WSDL (Web Services Description Language). Utilisez-les dans votre ServiceDescriptionFormatExtensionCollection si vous savez à l’avance le type d’élément d’extensibilité que vous souhaitez effectuer. Utilisez une XmlElement valeur lorsque vous ne connaissez pas le format d’un élément à l’avance.
Constructeurs
| Nom | Description |
|---|---|
| ServiceDescriptionFormatExtensionCollection(Object) |
Initialise une nouvelle instance de la classe ServiceDescriptionFormatExtensionCollection. |
Propriétés
| Nom | Description |
|---|---|
| Capacity |
Obtient ou définit le nombre d’éléments que le CollectionBase conteneur peut contenir. (Hérité de CollectionBase) |
| Count |
Obtient le nombre d’éléments contenus dans l’instance CollectionBase . Cette propriété ne peut pas être substituée. (Hérité de CollectionBase) |
| InnerList |
Obtient une ArrayList liste d’éléments dans l’instance CollectionBase . (Hérité de CollectionBase) |
| Item[Int32] |
Obtient ou définit la valeur d’un membre du ServiceDescriptionFormatExtensionCollection. |
| List |
Obtient une IList liste d’éléments dans l’instance CollectionBase . (Hérité de CollectionBase) |
| Table |
Obtient une interface qui implémente l’association des clés et des valeurs dans le ServiceDescriptionBaseCollection. (Hérité de ServiceDescriptionBaseCollection) |
Méthodes
| Nom | Description |
|---|---|
| Add(Object) |
Ajoute la valeur spécifiée ServiceDescriptionFormatExtension à la fin du ServiceDescriptionFormatExtensionCollection. |
| Clear() |
Supprime tous les objets de l’instance CollectionBase . Cette méthode ne peut pas être remplacée. (Hérité de CollectionBase) |
| Contains(Object) |
Retourne une valeur indiquant si le spécifié ServiceDescriptionFormatExtension est membre du ServiceDescriptionFormatExtensionCollection. |
| CopyTo(Object[], Int32) |
Copie l’intégralité ServiceDescriptionFormatExtensionCollection dans un tableau unidimensionnel de type ServiceDescriptionFormatExtension, en commençant à l’index de base zéro spécifié du tableau cible. |
| Equals(Object) |
Détermine si l’objet spécifié est égal à l’objet actuel. (Hérité de Object) |
| Find(String, String) |
Recherche un ServiceDescriptionFormatExtensionCollection membre avec le nom et l’URI d’espace de noms spécifiés. |
| Find(Type) |
Recherche et ServiceDescriptionFormatExtensionCollection retourne le premier élément du dérivé Typespécifié. |
| FindAll(String, String) |
Recherche et ServiceDescriptionFormatExtensionCollection retourne un tableau de tous les membres avec le nom et l’URI d’espace de noms spécifiés. |
| FindAll(Type) |
Recherche et ServiceDescriptionFormatExtensionCollection retourne un tableau de tous les éléments de l’élément spécifié Type. |
| GetEnumerator() |
Retourne un énumérateur qui itère au sein de l’instance CollectionBase . (Hérité de CollectionBase) |
| GetHashCode() |
Sert de fonction de hachage par défaut. (Hérité de Object) |
| GetKey(Object) |
Retourne le nom de la clé associée à la valeur passée par référence. (Hérité de ServiceDescriptionBaseCollection) |
| GetType() |
Obtient la Type de l’instance actuelle. (Hérité de Object) |
| IndexOf(Object) |
Recherche l’index spécifié ServiceDescriptionFormatExtension et retourne l’index de base zéro de la première instance avec la collection. |
| Insert(Int32, Object) |
Ajoute le spécifié ServiceDescriptionFormatExtension à l’index ServiceDescriptionFormatExtensionCollection de base zéro spécifié. |
| IsHandled(Object) |
Retourne une valeur indiquant si l’objet spécifié est utilisé par le processus d’importation lorsque l’élément d’extensibilité est importé dans le service Web XML. |
| IsRequired(Object) |
Retourne une valeur indiquant si l’objet spécifié est nécessaire pour l’opération du service Web XML. |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| OnClear() |
Efface le contenu de l’instance ServiceDescriptionBaseCollection . (Hérité de ServiceDescriptionBaseCollection) |
| OnClearComplete() |
Effectue des processus personnalisés supplémentaires après l’effacement du contenu de l’instance CollectionBase . (Hérité de CollectionBase) |
| OnInsert(Int32, Object) |
Effectue des processus personnalisés supplémentaires avant d’insérer un nouvel élément dans l’instance CollectionBase . (Hérité de CollectionBase) |
| OnInsertComplete(Int32, Object) |
Effectue des processus personnalisés supplémentaires après l’insertion d’un nouvel élément dans le ServiceDescriptionBaseCollection. (Hérité de ServiceDescriptionBaseCollection) |
| OnRemove(Int32, Object) |
Supprime un élément du ServiceDescriptionBaseCollection. (Hérité de ServiceDescriptionBaseCollection) |
| OnRemoveComplete(Int32, Object) |
Effectue des processus personnalisés supplémentaires après avoir supprimé un élément de l’instance CollectionBase . (Hérité de CollectionBase) |
| OnSet(Int32, Object, Object) |
Remplace une valeur par une autre dans le ServiceDescriptionBaseCollection. (Hérité de ServiceDescriptionBaseCollection) |
| OnSetComplete(Int32, Object, Object) |
Effectue des processus personnalisés supplémentaires après avoir défini une valeur dans l’instance CollectionBase . (Hérité de CollectionBase) |
| OnValidate(Object) |
Effectue des processus personnalisés supplémentaires lors de la validation d’une valeur. (Hérité de CollectionBase) |
| Remove(Object) |
Supprime la première occurrence du .ServiceDescriptionFormatExtensionServiceDescriptionFormatExtensionCollection |
| RemoveAt(Int32) |
Supprime l’élément à l’index spécifié de l’instance CollectionBase . Cette méthode n’est pas substituable. (Hérité de CollectionBase) |
| SetParent(Object, Object) |
Définit l’objet parent de l’instance ServiceDescriptionBaseCollection . (Hérité de ServiceDescriptionBaseCollection) |
| ToString() |
Retourne une chaîne qui représente l’objet actuel. (Hérité de Object) |
Implémentations d’interfaces explicites
| Nom | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
Copie l’intégralité CollectionBase dans une dimension unidimensionnelle Arraycompatible, en commençant à l’index spécifié du tableau cible. (Hérité de CollectionBase) |
| ICollection.IsSynchronized |
Obtient une valeur indiquant si l’accès au CollectionBase est synchronisé (thread safe). (Hérité de CollectionBase) |
| ICollection.SyncRoot |
Obtient un objet qui peut être utilisé pour synchroniser l’accès au CollectionBase. (Hérité de CollectionBase) |
| IList.Add(Object) |
Ajoute un objet à la fin du CollectionBase. (Hérité de CollectionBase) |
| IList.Contains(Object) |
Détermine si le CollectionBase conteneur contient un élément spécifique. (Hérité de CollectionBase) |
| IList.IndexOf(Object) |
Recherche l’index spécifié Object et retourne l’index de base zéro de la première occurrence dans l’ensemble CollectionBase. (Hérité de CollectionBase) |
| IList.Insert(Int32, Object) |
Insère un élément dans l’index CollectionBase spécifié. (Hérité de CollectionBase) |
| IList.IsFixedSize |
Obtient une valeur indiquant si la CollectionBase taille est fixe. (Hérité de CollectionBase) |
| IList.IsReadOnly |
Obtient une valeur indiquant si l’objet CollectionBase est en lecture seule. (Hérité de CollectionBase) |
| IList.Item[Int32] |
Obtient ou définit l’élément à l’index spécifié. (Hérité de CollectionBase) |
| IList.Remove(Object) |
Supprime la première occurrence d’un objet spécifique de l’objet CollectionBase. (Hérité de CollectionBase) |
Méthodes d’extension
| Nom | Description |
|---|---|
| AsParallel(IEnumerable) |
Active la parallélisation d’une requête. |
| AsQueryable(IEnumerable) |
Convertit un IEnumerable en IQueryable. |
| Cast<TResult>(IEnumerable) |
Convertit les éléments d’un IEnumerable en type spécifié. |
| OfType<TResult>(IEnumerable) |
Filtre les éléments d’une IEnumerable en fonction d’un type spécifié. |