Sdílet prostřednictvím


OperationMessageCollection Třída

Definice

Představuje kolekci OperationInput a OperationOutput zprávy související s webovou službou XML. Tuto třídu nelze zdědit.

public ref class OperationMessageCollection sealed : System::Web::Services::Description::ServiceDescriptionBaseCollection
public sealed class OperationMessageCollection : System.Web.Services.Description.ServiceDescriptionBaseCollection
type OperationMessageCollection = class
    inherit ServiceDescriptionBaseCollection
Public NotInheritable Class OperationMessageCollection
Inherits ServiceDescriptionBaseCollection
Dědičnost

Příklady

#using <System.dll>
#using <System.Web.Services.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::Xml;
using namespace System::Web::Services;
using namespace System::Web::Services::Description;

// Displays the properties of the OperationMessageCollection.
void DisplayFlowInputOutput( OperationMessageCollection^ myOperationMessageCollection, String^ myOperation )
{
   Console::WriteLine( "After {0}:", myOperation );
   Console::WriteLine( "Flow : {0}", myOperationMessageCollection->Flow );
   Console::WriteLine( "The first occurrence of operation Input in the collection {0}", myOperationMessageCollection->Input );
   Console::WriteLine( "The first occurrence of operation Output in the collection {0}", myOperationMessageCollection->Output );
   Console::WriteLine();
}

int main()
{
   try
   {
      ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_input_cs.wsdl" );
      PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes;

      // Get the OperationCollection for the SOAP protocol.
      OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations;

      // Get the OperationMessageCollection for the Add operation.
      OperationMessageCollection^ myOperationMessageCollection = myOperationCollection[ 0 ]->Messages;

      // Display the Flow, Input, and Output properties.
      DisplayFlowInputOutput( myOperationMessageCollection, "Start" );

      // Get the operation message for the Add operation.
      OperationMessage^ myOperationMessage = myOperationMessageCollection[ 0 ];
      OperationMessage^ myInputOperationMessage = dynamic_cast<OperationMessage^>(gcnew OperationInput);
      XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace );
      myInputOperationMessage->Message = myXmlQualifiedName;

      array<OperationMessage^>^myCollection = gcnew array<OperationMessage^>(myOperationMessageCollection->Count);
      myOperationMessageCollection->CopyTo( myCollection, 0 );
      Console::WriteLine( "Operation name(s) :" );
      for ( int i = 0; i < myCollection->Length; i++ )
      {
         Console::WriteLine( " {0}", myCollection[ i ]->Operation->Name );
      }

      // Add the OperationMessage to the collection.
      myOperationMessageCollection->Add( myInputOperationMessage );
      
      DisplayFlowInputOutput( myOperationMessageCollection, "Add" );
      
      if ( myOperationMessageCollection->Contains( myOperationMessage ))
      {
         int myIndex = myOperationMessageCollection->IndexOf( myOperationMessage );
         Console::WriteLine( " The index of the Add operation message in the collection is : {0}", myIndex );
      }

      myOperationMessageCollection->Remove( myInputOperationMessage );

      // Display Flow, Input, and Output after removing.
      DisplayFlowInputOutput( myOperationMessageCollection, "Remove" );

      // Insert the message at index 0 in the collection.
      myOperationMessageCollection->Insert( 0, myInputOperationMessage );

      // Display Flow, Input, and Output after inserting.
      DisplayFlowInputOutput( myOperationMessageCollection, "Insert" );

      myDescription->Write( "MathService_new_cs.wsdl" );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception caught!!!" );
      Console::WriteLine( "Source : {0}", e->Source );
      Console::WriteLine( "Message : {0}", e->Message );
   }
}
using System;
using System.Xml;
using System.Web.Services;
using System.Web.Services.Description;

class MyOperationMessageCollectionSample
{
   static void Main()
   {
      try
      {
         ServiceDescription myDescription =
            ServiceDescription.Read("MathService_input_cs.wsdl");
         PortTypeCollection myPortTypeCollection  =
            myDescription.PortTypes;

         // Get the OperationCollection for the SOAP protocol.
         OperationCollection myOperationCollection =
            myPortTypeCollection[0].Operations;

         // Get the OperationMessageCollection for the Add operation.
         OperationMessageCollection myOperationMessageCollection =
            myOperationCollection[0].Messages;

         // Display the Flow, Input, and Output properties.
         DisplayFlowInputOutput(myOperationMessageCollection, "Start");

         // Get the operation message for the Add operation.
         OperationMessage myOperationMessage =
            myOperationMessageCollection[0];
         OperationMessage myInputOperationMessage =
            (OperationMessage) new OperationInput();
         XmlQualifiedName myXmlQualifiedName = new XmlQualifiedName(
            "AddSoapIn", myDescription.TargetNamespace);
         myInputOperationMessage.Message = myXmlQualifiedName;

         OperationMessage[] myCollection =
            new OperationMessage[myOperationMessageCollection.Count];
         myOperationMessageCollection.CopyTo(myCollection, 0);
         Console.WriteLine("Operation name(s) :");
         for (int i = 0; i < myCollection.Length ; i++)
         {
            Console.WriteLine(" " + myCollection[i].Operation.Name);
         }

         // Add the OperationMessage to the collection.
         myOperationMessageCollection.Add(myInputOperationMessage);
         DisplayFlowInputOutput(myOperationMessageCollection, "Add");

         if(myOperationMessageCollection.Contains(myOperationMessage))
         {
            int myIndex =
               myOperationMessageCollection.IndexOf(myOperationMessage);
            Console.WriteLine(" The index of the Add operation " +
               "message in the collection is : " + myIndex);
         }

         myOperationMessageCollection.Remove(myInputOperationMessage);

         // Display Flow, Input, and Output after removing.
         DisplayFlowInputOutput(myOperationMessageCollection, "Remove");

         // Insert the message at index 0 in the collection.
         myOperationMessageCollection.Insert(0, myInputOperationMessage);

         // Display Flow, Input, and Output after inserting.
         DisplayFlowInputOutput(myOperationMessageCollection, "Insert");

         myDescription.Write("MathService_new_cs.wsdl");
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception caught!!!");
         Console.WriteLine("Source : " + e.Source);
         Console.WriteLine("Message : " + e.Message);
      }
   }

   // Displays the properties of the OperationMessageCollection.
   public static void DisplayFlowInputOutput( OperationMessageCollection
      myOperationMessageCollection, string myOperation)
   {
      Console.WriteLine("After " + myOperation + ":");
      Console.WriteLine("Flow : " + myOperationMessageCollection.Flow);
      Console.WriteLine("The first occurrence of operation Input " +
         "in the collection " + myOperationMessageCollection.Input);
      Console.WriteLine("The first occurrence of operation Output " +
         "in the collection " + myOperationMessageCollection.Output);
      Console.WriteLine();
   }
}
Imports System.Xml
Imports System.Web.Services
Imports System.Web.Services.Description

Class MyOperationMessageCollectionSample
   
   Shared Sub Main()
      Try
         Dim myDescription As ServiceDescription = _
            ServiceDescription.Read("MathService_input_vb.wsdl")
         Dim myPortTypeCollection As PortTypeCollection = _
            myDescription.PortTypes

         ' Get the OperationCollection for the SOAP protocol.
         Dim myOperationCollection As OperationCollection = _
            myPortTypeCollection(0).Operations

         ' Get the OperationMessageCollection for the Add operation.
         Dim myOperationMessageCollection As OperationMessageCollection = _
            myOperationCollection(0).Messages
         ' Display the Flow, Input, and Output properties.
         DisplayFlowInputOutput(myOperationMessageCollection, "Start")

         ' Get the operation message for the Add operation.
         Dim myOperationMessage As OperationMessage = _
            myOperationMessageCollection.Item(0)
         Dim myInputOperationMessage As OperationMessage = _
            CType(New OperationInput(), OperationMessage)
         Dim myXmlQualifiedName As _
            New XmlQualifiedName("AddSoapIn", myDescription.TargetNamespace)
         myInputOperationMessage.Message = myXmlQualifiedName
         
         Dim myCollection(myOperationMessageCollection.Count -1 ) _
            As OperationMessage
         myOperationMessageCollection.CopyTo(myCollection, 0)
         Console.WriteLine("Operation name(s) :")
         Dim i As Integer
         For i = 0 To myCollection.Length - 1
            Console.WriteLine(" " & myCollection(i).Operation.Name)
         Next i

         ' Add the OperationMessage to the collection.
         myOperationMessageCollection.Add(myInputOperationMessage)
         DisplayFlowInputOutput(myOperationMessageCollection, "Add")
         
         If myOperationMessageCollection.Contains(myOperationMessage) _
            = True Then
            Dim myIndex As Integer = _
               myOperationMessageCollection.IndexOf(myOperationMessage)
            Console.WriteLine(" The index of the Add operation " & _
                "message in the collection is : " & myIndex.ToString())
         End If

         myOperationMessageCollection.Remove(myInputOperationMessage)

         ' Display Flow, Input, and Output after removing.
         DisplayFlowInputOutput(myOperationMessageCollection, "Remove")

         ' Insert the message at index 0 in the collection.
         myOperationMessageCollection.Insert(0, myInputOperationMessage)

         ' Display Flow, Input, and Output after inserting.
         DisplayFlowInputOutput(myOperationMessageCollection, "Insert")

         myDescription.Write("MathService_new_vb.wsdl")
      Catch e As Exception
         Console.WriteLine("Exception caught!!!")
         Console.WriteLine("Source : " & e.Source.ToString())
         Console.WriteLine("Message : " & e.Message.ToString())
      End Try
   End Sub
   
   ' Displays the properties of the OperationMessageCollection.
   Public Shared Sub DisplayFlowInputOutput(myOperationMessageCollection As  _
      OperationMessageCollection, myOperation As String)

      Console.WriteLine("After " & myOperation.ToString() & ":")
      Console.WriteLine("Flow : " & _
         myOperationMessageCollection.Flow.ToString())
      Console.WriteLine("The first occurrence of operation Input " & _
         "in the collection {0}" , myOperationMessageCollection.Input)
      Console.WriteLine("The first occurrence of operation Output " & _
         "in the collection " &  myOperationMessageCollection.Output.ToString())
      Console.WriteLine()
   End Sub
End Class

Poznámky

Instance této třídy bude vrácena Messages vlastností nadřazeného Operationobjektu . Jako takové může mít přesně dva členy, jeden a OperationInput druhý člen .OperationOutput

Vlastnosti

Name Description
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 CollectionBase v instanci. Tuto vlastnost nelze přepsat.

(Zděděno od CollectionBase)
Flow

Získá typ přenosu podporovaného OperationMessageCollection.

InnerList

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

(Zděděno od CollectionBase)
Input

Získá první výskyt uvnitř OperationInput kolekce.

Item[Int32]

Získá nebo nastaví hodnotu v zadaném indexu založeném OperationMessage na nule.

List

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

(Zděděno od CollectionBase)
Output

Získá první výskyt uvnitř OperationOutput kolekce.

Table

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

(Zděděno od ServiceDescriptionBaseCollection)

Metody

Name Description
Add(OperationMessage)

Přidá zadanou OperationMessage hodnotu na konec OperationMessageCollection.

Clear()

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

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

Určuje, zda je zadaný OperationMessage člen OperationMessageCollection.

CopyTo(OperationMessage[], Int32)

Zkopíruje celý OperationMessageCollection do kompatibilního jednorozměrného pole typu OperationMessage, počínaje zadaným indexem založeným na nule cílového pole.

Equals(Object)

Určuje, zda je zadaný objekt roven aktuálnímu objektu.

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

Vrátí enumerátor, 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()

Získá Type aktuální instance.

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

Vyhledá zadaný OperationMessage index a vrátí index založený na nule prvního výskytu v kolekci.

Insert(Int32, OperationMessage)

Přidá zadanou OperationMessage hodnotu do zadaného indexu založeného OperationMessageCollection na nule.

MemberwiseClone()

Vytvoří mělkou kopii aktuálního Object.

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

Vymaže obsah ServiceDescriptionBaseCollection instance.

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

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

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

Provádí další vlastní procesy před vložením nového prvku do CollectionBase instance.

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

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

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

Odebere prvek z objektu ServiceDescriptionBaseCollection.

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

Provádí 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(OperationMessage)

Odebere první výskyt zadaného OperationMessage z objektu OperationMessageCollection.

RemoveAt(Int32)

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

(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í

Name Description
ICollection.CopyTo(Array, Int32)

Zkopíruje celý CollectionBase soubor 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 CollectionBase této synchronizaci (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 obsahuje CollectionBase určitý prvek.

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

Vyhledá zadaný Object index a vrátí index založený na nule prvního výskytu v celém CollectionBaserozsahu .

(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 určující, zda je jen pro CollectionBase čtení.

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

Získá nebo nastaví prvek v zadaném 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í

Name Description
AsParallel(IEnumerable)

Umožňuje paralelizaci dotazu.

AsQueryable(IEnumerable)

Převede IEnumerable na IQueryable.

Cast<TResult>(IEnumerable)

Přetypuje prvky IEnumerable na zadaný typ.

OfType<TResult>(IEnumerable)

Filtruje prvky IEnumerable na základě zadaného typu.

Platí pro