ServiceDescriptionFormatExtensionCollection Klasa

Definicja

Reprezentuje kolekcję elementów rozszerzalności używanych przez usługę sieci Web XML. Klasa ta nie może być dziedziczona.

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

Przykłady

#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

Uwagi

Ta kolekcja może zawierać wystąpienia klas pochodnych z ServiceDescriptionFormatExtensionklasy lub wystąpień XmlElement klasy . W klasie ServiceDescriptionFormatExtension pochodnej klasa umożliwia użytkownikom definiowanie elementów rozszerzalności oprócz elementów zdefiniowanych w specyfikacji WSDL (Web Services Description Language). Użyj ich w swoim ServiceDescriptionFormatExtensionCollection przypadku, jeśli wiesz z wyprzedzeniem typ elementu rozszerzalności, który chcesz utworzyć. Użyj elementu XmlElement , jeśli nie znasz formatu elementu z wyprzedzeniem.

Konstruktory

ServiceDescriptionFormatExtensionCollection(Object)

Inicjuje nowe wystąpienie klasy ServiceDescriptionFormatExtensionCollection.

Właściwości

Capacity

Pobiera lub ustawia liczbę elementów, które CollectionBase mogą zawierać.

(Odziedziczone po CollectionBase)
Count

Pobiera liczbę elementów zawartych w wystąpieniu CollectionBase . Tej właściwości nie można zastąpić.

(Odziedziczone po CollectionBase)
InnerList

Pobiera obiekt ArrayList zawierający listę elementów w wystąpieniu CollectionBase .

(Odziedziczone po CollectionBase)
Item[Int32]

Pobiera lub ustawia wartość elementu członkowskiego .ServiceDescriptionFormatExtensionCollection

List

Pobiera obiekt IList zawierający listę elementów w wystąpieniu CollectionBase .

(Odziedziczone po CollectionBase)
Table

Pobiera interfejs implementujący skojarzenie kluczy i wartości w obiekcie ServiceDescriptionBaseCollection.

(Odziedziczone po ServiceDescriptionBaseCollection)

Metody

Add(Object)

Dodaje określony ServiceDescriptionFormatExtension element na końcu obiektu ServiceDescriptionFormatExtensionCollection.

Clear()

Usuwa wszystkie obiekty z CollectionBase wystąpienia. Tej metody nie można zastąpić.

(Odziedziczone po CollectionBase)
Contains(Object)

Zwraca wartość wskazującą, czy określony ServiceDescriptionFormatExtension element jest elementem członkowskim .ServiceDescriptionFormatExtensionCollection

CopyTo(Object[], Int32)

Kopiuje całość ServiceDescriptionFormatExtensionCollection do jednowymiarowej tablicy typu ServiceDescriptionFormatExtension, zaczynając od określonego indeksu zerowego tablicy docelowej.

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
Find(String, String)

Wyszukuje ServiceDescriptionFormatExtensionCollection element członkowski o określonej nazwie i identyfikatorze URI przestrzeni nazw.

Find(Type)

Wyszukuje element ServiceDescriptionFormatExtensionCollection i zwraca pierwszy element określonego pochodnego Typeelementu .

FindAll(String, String)

Wyszukuje i ServiceDescriptionFormatExtensionCollection zwraca tablicę wszystkich elementów członkowskich z określoną nazwą i identyfikatorem URI przestrzeni nazw.

FindAll(Type)

Wyszukuje i ServiceDescriptionFormatExtensionCollection zwraca tablicę wszystkich elementów określonego Typeelementu .

GetEnumerator()

Zwraca moduł wyliczający, który iteruje po wystąpieniu CollectionBase .

(Odziedziczone po CollectionBase)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetKey(Object)

Zwraca nazwę klucza skojarzonego z wartością przekazaną przez odwołanie.

(Odziedziczone po ServiceDescriptionBaseCollection)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
IndexOf(Object)

Wyszukuje określony ServiceDescriptionFormatExtension i zwraca indeks oparty na zerze pierwszego wystąpienia z kolekcją.

Insert(Int32, Object)

Dodaje określony ServiceDescriptionFormatExtension element do określonego indeksu ServiceDescriptionFormatExtensionCollection opartego na zerze.

IsHandled(Object)

Zwraca wartość wskazującą, czy określony obiekt jest używany przez proces importowania, gdy element rozszerzalności jest importowany do usługi sieci Web XML.

IsRequired(Object)

Zwraca wartość wskazującą, czy określony obiekt jest niezbędny do działania usługi sieci Web XML.

MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
OnClear()

Czyści zawartość ServiceDescriptionBaseCollection wystąpienia.

(Odziedziczone po ServiceDescriptionBaseCollection)
OnClearComplete()

Wykonuje dodatkowe procesy niestandardowe po wyczyszczeniu zawartości CollectionBase wystąpienia.

(Odziedziczone po CollectionBase)
OnInsert(Int32, Object)

Wykonuje dodatkowe procesy niestandardowe przed wstawieniem nowego elementu do CollectionBase wystąpienia.

(Odziedziczone po CollectionBase)
OnInsertComplete(Int32, Object)

Wykonuje dodatkowe procesy niestandardowe po wstawieniu nowego elementu do elementu ServiceDescriptionBaseCollection.

(Odziedziczone po ServiceDescriptionBaseCollection)
OnRemove(Int32, Object)

Usuwa element z elementu ServiceDescriptionBaseCollection.

(Odziedziczone po ServiceDescriptionBaseCollection)
OnRemoveComplete(Int32, Object)

Wykonuje dodatkowe procesy niestandardowe po usunięciu CollectionBase elementu z wystąpienia.

(Odziedziczone po CollectionBase)
OnSet(Int32, Object, Object)

Zamienia jedną wartość na inną w obiekcie ServiceDescriptionBaseCollection.

(Odziedziczone po ServiceDescriptionBaseCollection)
OnSetComplete(Int32, Object, Object)

Wykonuje dodatkowe procesy niestandardowe po ustawieniu wartości w wystąpieniu CollectionBase .

(Odziedziczone po CollectionBase)
OnValidate(Object)

Wykonuje dodatkowe procesy niestandardowe podczas sprawdzania poprawności wartości.

(Odziedziczone po CollectionBase)
Remove(Object)

Usuwa pierwsze wystąpienie określonego ServiceDescriptionFormatExtension elementu z .ServiceDescriptionFormatExtensionCollection

RemoveAt(Int32)

Usuwa element w określonym indeksie CollectionBase wystąpienia. Ta metoda nie jest zastępowalna.

(Odziedziczone po CollectionBase)
SetParent(Object, Object)

Ustawia obiekt ServiceDescriptionBaseCollection nadrzędny wystąpienia.

(Odziedziczone po ServiceDescriptionBaseCollection)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Jawne implementacje interfejsu

ICollection.CopyTo(Array, Int32)

Kopiuje całość CollectionBase do zgodnego jednowymiarowego Arrayobiektu , zaczynając od określonego indeksu tablicy docelowej.

(Odziedziczone po CollectionBase)
ICollection.IsSynchronized

Pobiera wartość wskazującą, czy dostęp do elementu CollectionBase jest synchronizowany (bezpieczny wątk).

(Odziedziczone po CollectionBase)
ICollection.SyncRoot

Pobiera obiekt, który może służyć do synchronizowania dostępu do obiektu CollectionBase.

(Odziedziczone po CollectionBase)
IList.Add(Object)

Dodaje obiekt na końcu obiektu CollectionBase.

(Odziedziczone po CollectionBase)
IList.Contains(Object)

Określa, czy element CollectionBase zawiera określony element.

(Odziedziczone po CollectionBase)
IList.IndexOf(Object)

Wyszukuje określony Object element i zwraca indeks oparty na zerze pierwszego wystąpienia w całym CollectionBaseobiekcie .

(Odziedziczone po CollectionBase)
IList.Insert(Int32, Object)

Wstawia element do określonego indeksu CollectionBase .

(Odziedziczone po CollectionBase)
IList.IsFixedSize

Pobiera wartość wskazującą, czy ma CollectionBase stały rozmiar.

(Odziedziczone po CollectionBase)
IList.IsReadOnly

Pobiera wartość wskazującą, czy kolekcja CollectionBase jest przeznaczona tylko do odczytu.

(Odziedziczone po CollectionBase)
IList.Item[Int32]

Pobiera lub ustawia element pod określonym indeksem.

(Odziedziczone po CollectionBase)
IList.Remove(Object)

Usuwa pierwsze wystąpienie określonego obiektu z obiektu CollectionBase.

(Odziedziczone po CollectionBase)

Metody rozszerzania

Cast<TResult>(IEnumerable)

Rzutuje elementy obiektu IEnumerable na określony typ.

OfType<TResult>(IEnumerable)

Filtruje elementy IEnumerable elementu na podstawie określonego typu.

AsParallel(IEnumerable)

Umożliwia równoległość zapytania.

AsQueryable(IEnumerable)

Konwertuje element IEnumerable na .IQueryable

Dotyczy