ServiceDescriptionFormatExtensionCollection Klasse

Definition

Stellt die Auflistung von Erweiterbarkeitselementen dar, die vom XML-Webdienst verwendet werden. Diese Klasse kann nicht vererbt werden.

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
Vererbung
ServiceDescriptionFormatExtensionCollection

Beispiele

#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

Hinweise

Diese Auflistung kann entweder Instanzen von Klassen enthalten, die von ServiceDescriptionFormatExtensionder Klasse abgeleitet werden, oder Instanzen der XmlElement Klasse. In einer abgeleiteten Klasse ServiceDescriptionFormatExtension können Benutzer erweiterungselemente zusätzlich zu den in der WSDL-Spezifikation (Web Services Description Language) definierten Elementen definieren. Verwenden Sie diese in Ihrem ServiceDescriptionFormatExtensionCollection Szenario, wenn Sie im Voraus wissen, welche Art von Erweiterbarkeitselement Sie erstellen möchten. Verwenden Sie ein XmlElement Element, wenn Sie das Format eines Elements im Voraus nicht kennen.

Konstruktoren

Name Beschreibung
ServiceDescriptionFormatExtensionCollection(Object)

Initialisiert eine neue Instanz der ServiceDescriptionFormatExtensionCollection-Klasse.

Eigenschaften

Name Beschreibung
Capacity

Ruft die Anzahl der Elemente ab, die dies enthalten kann, oder legt diese CollectionBase fest.

(Geerbt von CollectionBase)
Count

Ruft die Anzahl der In der CollectionBase Instanz enthaltenen Elemente ab. Diese Eigenschaft kann nicht außer Kraft gesetzt werden.

(Geerbt von CollectionBase)
InnerList

Ruft eine ArrayList liste der Elemente in der CollectionBase Instanz ab.

(Geerbt von CollectionBase)
Item[Int32]

Dient zum Abrufen oder Festlegen des Werts eines Elements der .ServiceDescriptionFormatExtensionCollection

List

Ruft eine IList liste der Elemente in der CollectionBase Instanz ab.

(Geerbt von CollectionBase)
Table

Ruft eine Schnittstelle ab, die die Zuordnung der Schlüssel und Werte in der ServiceDescriptionBaseCollection.

(Geerbt von ServiceDescriptionBaseCollection)

Methoden

Name Beschreibung
Add(Object)

Fügt das angegebene ServiceDescriptionFormatExtension Ende der .ServiceDescriptionFormatExtensionCollection

Clear()

Entfernt alle Objekte aus der CollectionBase Instanz. Diese Methode kann nicht überschrieben werden.

(Geerbt von CollectionBase)
Contains(Object)

Gibt einen Wert zurück, der angibt, ob es sich bei dem angegebenen ServiceDescriptionFormatExtension Element um ein Element der ServiceDescriptionFormatExtensionCollection.

CopyTo(Object[], Int32)

Kopiert das Gesamte ServiceDescriptionFormatExtensionCollection in ein eindimensionales Array vom Typ ServiceDescriptionFormatExtension, beginnend mit dem angegebenen nullbasierten Index des Zielarrays.

Equals(Object)

Bestimmt, ob das angegebene Objekt dem aktuellen Objekt entspricht.

(Geerbt von Object)
Find(String, String)

Sucht nach ServiceDescriptionFormatExtensionCollection einem Element mit dem angegebenen Namen und namespace-URI.

Find(Type)

Durchsucht das ServiceDescriptionFormatExtensionCollection erste Element des angegebenen abgeleiteten Elements und gibt es zurück Type.

FindAll(String, String)

Durchsucht und ServiceDescriptionFormatExtensionCollection gibt ein Array aller Member mit dem angegebenen Namen und namespace-URI zurück.

FindAll(Type)

Durchsucht das ServiceDescriptionFormatExtensionCollection Array aller Elemente des angegebenen Elements und gibt es zurück Type.

GetEnumerator()

Gibt einen Enumerator zurück, der die CollectionBase Instanz durchläuft.

(Geerbt von CollectionBase)
GetHashCode()

Dient als Standardhashfunktion.

(Geerbt von Object)
GetKey(Object)

Gibt den Namen des Schlüssels zurück, der dem durch Verweis übergebenen Wert zugeordnet ist.

(Geerbt von ServiceDescriptionBaseCollection)
GetType()

Ruft die Type der aktuellen Instanz ab.

(Geerbt von Object)
IndexOf(Object)

Sucht nach dem angegebenen Und ServiceDescriptionFormatExtension gibt den nullbasierten Index der ersten Instanz mit der Auflistung zurück.

Insert(Int32, Object)

Fügt den angegebenen nullbasierten Index dem ServiceDescriptionFormatExtension angegebenen ServiceDescriptionFormatExtensionCollection Nullindex hinzu.

IsHandled(Object)

Gibt einen Wert zurück, der angibt, ob das angegebene Objekt vom Importprozess verwendet wird, wenn das Erweiterbarkeitselement in den XML-Webdienst importiert wird.

IsRequired(Object)

Gibt einen Wert zurück, der angibt, ob das angegebene Objekt für den Vorgang des XML-Webdiensts erforderlich ist.

MemberwiseClone()

Erstellt eine flache Kopie der aktuellen Object.

(Geerbt von Object)
OnClear()

Löscht den Inhalt der ServiceDescriptionBaseCollection Instanz.

(Geerbt von ServiceDescriptionBaseCollection)
OnClearComplete()

Führt zusätzliche benutzerdefinierte Prozesse aus, nachdem der Inhalt der CollectionBase Instanz gelöscht wurde.

(Geerbt von CollectionBase)
OnInsert(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse aus, bevor ein neues Element in die CollectionBase Instanz eingefügt wird.

(Geerbt von CollectionBase)
OnInsertComplete(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse nach dem Einfügen eines neuen Elements in die ServiceDescriptionBaseCollection.

(Geerbt von ServiceDescriptionBaseCollection)
OnRemove(Int32, Object)

Entfernt ein Element aus dem ServiceDescriptionBaseCollection.

(Geerbt von ServiceDescriptionBaseCollection)
OnRemoveComplete(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse aus, nachdem ein Element aus der CollectionBase Instanz entfernt wurde.

(Geerbt von CollectionBase)
OnSet(Int32, Object, Object)

Ersetzt einen Wert durch einen anderen innerhalb der ServiceDescriptionBaseCollection.

(Geerbt von ServiceDescriptionBaseCollection)
OnSetComplete(Int32, Object, Object)

Führt nach dem Festlegen eines Werts in der CollectionBase Instanz weitere benutzerdefinierte Prozesse aus.

(Geerbt von CollectionBase)
OnValidate(Object)

Führt beim Überprüfen eines Werts zusätzliche benutzerdefinierte Prozesse aus.

(Geerbt von CollectionBase)
Remove(Object)

Entfernt das erste Vorkommen des angegebenen ServiceDescriptionFormatExtension Aus.ServiceDescriptionFormatExtensionCollection

RemoveAt(Int32)

Entfernt das Element am angegebenen Index der CollectionBase Instanz. Diese Methode kann nicht außer Kraft gesetzt werden.

(Geerbt von CollectionBase)
SetParent(Object, Object)

Legt das übergeordnete Objekt der ServiceDescriptionBaseCollection Instanz fest.

(Geerbt von ServiceDescriptionBaseCollection)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Explizite Schnittstellenimplementierungen

Name Beschreibung
ICollection.CopyTo(Array, Int32)

Kopiert das Gesamte CollectionBase in einen kompatiblen eindimensionalen Array, beginnend am angegebenen Index des Zielarrays.

(Geerbt von CollectionBase)
ICollection.IsSynchronized

Ruft einen Wert ab, der angibt, ob der Zugriff auf die CollectionBase Synchronisierung (Threadsicher) erfolgt.

(Geerbt von CollectionBase)
ICollection.SyncRoot

Ruft ein Objekt ab, das zum Synchronisieren des Zugriffs auf die CollectionBaseverwendet werden kann.

(Geerbt von CollectionBase)
IList.Add(Object)

Fügt ein Objekt am Ende der .CollectionBase

(Geerbt von CollectionBase)
IList.Contains(Object)

Bestimmt, ob das CollectionBase Element ein bestimmtes Element enthält.

(Geerbt von CollectionBase)
IList.IndexOf(Object)

Sucht nach dem angegebenen Object Und gibt den nullbasierten Index des ersten Vorkommens innerhalb des gesamten CollectionBasezurück.

(Geerbt von CollectionBase)
IList.Insert(Int32, Object)

Fügt ein Element in den CollectionBase angegebenen Index ein.

(Geerbt von CollectionBase)
IList.IsFixedSize

Ruft einen Wert ab, der angibt, ob die CollectionBase Größe fest ist.

(Geerbt von CollectionBase)
IList.IsReadOnly

Ruft einen Wert ab, der angibt, ob dies CollectionBase schreibgeschützt ist.

(Geerbt von CollectionBase)
IList.Item[Int32]

Ruft das Element am angegebenen Index ab oder legt es fest.

(Geerbt von CollectionBase)
IList.Remove(Object)

Entfernt das erste Vorkommen eines bestimmten Objekts aus dem CollectionBase.

(Geerbt von CollectionBase)

Erweiterungsmethoden

Name Beschreibung
AsParallel(IEnumerable)

Aktiviert die Parallelisierung einer Abfrage.

AsQueryable(IEnumerable)

Wandelt eine IEnumerable in eine IQueryableum.

Cast<TResult>(IEnumerable)

Wandelt die Elemente eines IEnumerable in den angegebenen Typ um.

OfType<TResult>(IEnumerable)

Filtert die Elemente einer IEnumerable basierend auf einem angegebenen Typ.

Gilt für: