Sdílet prostřednictvím


ServiceDescriptionFormatExtensionCollection Třída

Definice

Představuje kolekci prvků rozšiřitelnosti používaných webovou službou XML. Tuto třídu nelze dědit.

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
Dědičnost
ServiceDescriptionFormatExtensionCollection

Příklady

#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

Poznámky

Tato kolekce může obsahovat instance tříd odvozených z ServiceDescriptionFormatExtensiontřídy nebo instance XmlElement třídy. V odvozené třídě ServiceDescriptionFormatExtension třída umožňuje uživatelům definovat prvky rozšiřitelnosti kromě prvků definovaných ve specifikaci WSDL (Web Services Description Language). Použijte je ve svém ServiceDescriptionFormatExtensionCollection případě, pokud znáte předem typ prvku rozšiřitelnosti, který chcete vytvořit. XmlElement Použijte, když předem neznáte formát prvku.

Konstruktory

ServiceDescriptionFormatExtensionCollection(Object)

Inicializuje novou instanci ServiceDescriptionFormatExtensionCollection třídy.

Vlastnosti

Capacity

Získá nebo nastaví počet prvků, které CollectionBase může obsahovat.

(Zděděno od CollectionBase)
Count

Získá počet prvků obsažených v CollectionBase instanci. Tuto vlastnost nelze přepsat.

(Zděděno od CollectionBase)
InnerList

ArrayList Získá obsahující seznam prvků v CollectionBase instanci.

(Zděděno od CollectionBase)
Item[Int32]

Získá nebo nastaví hodnotu člena ServiceDescriptionFormatExtensionCollection.

List

IList Získá obsahující seznam prvků v CollectionBase instanci.

(Zděděno od CollectionBase)
Table

Získá rozhraní, které implementuje přidružení klíčů a hodnot v souboru ServiceDescriptionBaseCollection.

(Zděděno od ServiceDescriptionBaseCollection)

Metody

Add(Object)

Přidá zadaný ServiceDescriptionFormatExtension na konec .ServiceDescriptionFormatExtensionCollection

Clear()

Odebere všechny objekty z CollectionBase instance. Tuto metodu nelze přepsat.

(Zděděno od CollectionBase)
Contains(Object)

Vrátí hodnotu označující, zda je zadaným ServiceDescriptionFormatExtension členem ServiceDescriptionFormatExtensionCollection.

CopyTo(Object[], Int32)

Zkopíruje celý ServiceDescriptionFormatExtensionCollection objekt do jednorozměrného pole typu ServiceDescriptionFormatExtension, počínaje zadaným indexem nuly cílového pole.

Equals(Object)

Určí, zda se zadaný objekt rovná aktuálnímu objektu.

(Zděděno od Object)
Find(String, String)

ServiceDescriptionFormatExtensionCollection Vyhledá člena se zadaným názvem a identifikátorem URI oboru názvů.

Find(Type)

ServiceDescriptionFormatExtensionCollection Vyhledá a vrátí první prvek zadané odvozené Type.

FindAll(String, String)

ServiceDescriptionFormatExtensionCollection Vyhledá a vrátí pole všech členů se zadaným názvem a identifikátorem URI oboru názvů.

FindAll(Type)

ServiceDescriptionFormatExtensionCollection Vyhledá a vrátí pole všech prvků zadaného Type.

GetEnumerator()

Vrátí výčet, který iteruje prostřednictvím CollectionBase instance.

(Zděděno od CollectionBase)
GetHashCode()

Slouží jako výchozí funkce hash.

(Zděděno od Object)
GetKey(Object)

Vrátí název klíče přidruženého k hodnotě předané odkazem.

(Zděděno od ServiceDescriptionBaseCollection)
GetType()

Type Získá aktuální instanci.

(Zděděno od Object)
IndexOf(Object)

Vyhledá zadaný ServiceDescriptionFormatExtension index a vrátí nulový index první instance s kolekcí.

Insert(Int32, Object)

Přidá zadané ServiceDescriptionFormatExtension do zadaného indexu založeného ServiceDescriptionFormatExtensionCollection na nule.

IsHandled(Object)

Vrátí hodnotu určující, zda zadaný objekt je používán procesem importu při importu elementu rozšiřitelnosti do webové služby XML.

IsRequired(Object)

Vrátí hodnotu určující, zda je zadaný objekt nezbytný pro provoz webové služby XML.

MemberwiseClone()

Vytvoří použádnou kopii aktuálního souboru Object.

(Zděděno od Object)
OnClear()

Vymaže obsah ServiceDescriptionBaseCollection instance.

(Zděděno od ServiceDescriptionBaseCollection)
OnClearComplete()

Provede další vlastní procesy po vymazání obsahu CollectionBase instance.

(Zděděno od CollectionBase)
OnInsert(Int32, Object)

Před vložením nového prvku do CollectionBase instance provede další vlastní procesy.

(Zděděno od CollectionBase)
OnInsertComplete(Int32, Object)

Provede další vlastní procesy po vložení nového prvku do ServiceDescriptionBaseCollectionsouboru .

(Zděděno od ServiceDescriptionBaseCollection)
OnRemove(Int32, Object)

Odebere prvek z objektu ServiceDescriptionBaseCollection.

(Zděděno od ServiceDescriptionBaseCollection)
OnRemoveComplete(Int32, Object)

Provede další vlastní procesy po odebrání elementu CollectionBase z instance.

(Zděděno od CollectionBase)
OnSet(Int32, Object, Object)

Nahradí jednu hodnotu jinou v rámci .ServiceDescriptionBaseCollection

(Zděděno od ServiceDescriptionBaseCollection)
OnSetComplete(Int32, Object, Object)

Provede další vlastní procesy po nastavení hodnoty v CollectionBase instanci.

(Zděděno od CollectionBase)
OnValidate(Object)

Provádí další vlastní procesy při ověřování hodnoty.

(Zděděno od CollectionBase)
Remove(Object)

Odebere první výskyt zadaného ze ServiceDescriptionFormatExtensionCollectionzadaného ServiceDescriptionFormatExtension souboru .

RemoveAt(Int32)

Odebere prvek v zadaném indexu CollectionBase instance. Tato metoda není přepsána.

(Zděděno od CollectionBase)
SetParent(Object, Object)

Nastaví nadřazený objekt ServiceDescriptionBaseCollection instance.

(Zděděno od ServiceDescriptionBaseCollection)
ToString()

Vrátí řetězec, který představuje aktuální objekt.

(Zděděno od Object)

Explicitní implementace rozhraní

ICollection.CopyTo(Array, Int32)

Zkopíruje celý CollectionBase objekt do kompatibilního jednorozměrného Array, počínaje zadaným indexem cílového pole.

(Zděděno od CollectionBase)
ICollection.IsSynchronized

Získá hodnotu označující, zda je přístup k ho CollectionBase synchronizován (bezpečné vlákno).

(Zděděno od CollectionBase)
ICollection.SyncRoot

Získá objekt, který lze použít k synchronizaci přístupu k CollectionBase.

(Zděděno od CollectionBase)
IList.Add(Object)

Přidá objekt na konec objektu CollectionBase.

(Zděděno od CollectionBase)
IList.Contains(Object)

Určuje, zda CollectionBase obsahuje konkrétní prvek.

(Zděděno od CollectionBase)
IList.IndexOf(Object)

Vyhledá zadaný Object index a vrátí nulový index prvního výskytu v rámci celého CollectionBasesouboru .

(Zděděno od CollectionBase)
IList.Insert(Int32, Object)

Vloží prvek do zadaného indexu CollectionBase .

(Zděděno od CollectionBase)
IList.IsFixedSize

Získá hodnotu určující, zda CollectionBase má pevnou velikost.

(Zděděno od CollectionBase)
IList.IsReadOnly

Získá hodnotu, která určuje, zda je CollectionBase určena jen pro čtení.

(Zděděno od CollectionBase)
IList.Item[Int32]

Získá nebo nastaví prvek u zadaného indexu.

(Zděděno od CollectionBase)
IList.Remove(Object)

Odebere první výskyt konkrétního objektu z objektu CollectionBase.

(Zděděno od CollectionBase)

Metody rozšíření

Cast<TResult>(IEnumerable)

Přetypuje prvky zadaného IEnumerable typu.

OfType<TResult>(IEnumerable)

Filtruje prvky IEnumerable založené na zadaném typu.

AsParallel(IEnumerable)

Umožňuje paralelizaci dotazu.

AsQueryable(IEnumerable)

Převede na IEnumerable IQueryable.

Platí pro