OperationCollection Klasa

Definicja

Reprezentuje kolekcję wystąpień Operation klasy. Klasa ta nie może być dziedziczona.

public ref class OperationCollection sealed : System::Web::Services::Description::ServiceDescriptionBaseCollection
public sealed class OperationCollection : System.Web.Services.Description.ServiceDescriptionBaseCollection
type OperationCollection = class
    inherit ServiceDescriptionBaseCollection
Public NotInheritable Class OperationCollection
Inherits ServiceDescriptionBaseCollection
Dziedziczenie

Przykłady

W poniższym przykładzie pokazano użycie właściwości i metod uwidocznionych przez klasę OperationCollection .

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

using namespace System;
using namespace System::Web::Services;
using namespace System::Xml;
using namespace System::Web::Services::Description;
int main()
{
   try
   {
      // Read the 'MathService_Input_cs.wsdl' file.
      ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_Input_cs.wsdl" );
      PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes;

      // Get the 'OperationCollection' for 'SOAP' protocol.

      OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations;
      Operation^ myOperation = gcnew Operation;
      myOperation->Name = "Add";
      OperationMessage^ myOperationMessageInput = (OperationMessage^)(gcnew OperationInput);
      myOperationMessageInput->Message = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace );
      OperationMessage^ myOperationMessageOutput = (OperationMessage^)(gcnew OperationOutput);
      myOperationMessageOutput->Message = gcnew XmlQualifiedName( "AddSoapOut",myDescription->TargetNamespace );
      myOperation->Messages->Add( myOperationMessageInput );
      myOperation->Messages->Add( myOperationMessageOutput );
      myOperationCollection->Add( myOperation );

      if ( myOperationCollection->Contains( myOperation ) == true )
      {
         Console::WriteLine( "The index of the added 'myOperation' operation is : {0}", myOperationCollection->IndexOf( myOperation ) );
      }

      myOperationCollection->Remove( myOperation );
      
      // Insert the 'myOpearation' operation at the index '0'.
      myOperationCollection->Insert( 0, myOperation );
      Console::WriteLine( "The operation at index '0' is : {0}", myOperationCollection[ 0 ]->Name );

      array<Operation^>^myOperationArray = gcnew array<Operation^>(myOperationCollection->Count);
      myOperationCollection->CopyTo( myOperationArray, 0 );
      Console::WriteLine( "The operation(s) in the collection are :" );
      for ( int i = 0; i < myOperationCollection->Count; i++ )
      {
         Console::WriteLine( " {0}", myOperationArray[ i ]->Name );
      }

      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.Web.Services;
using System.Xml;
using System.Web.Services.Description;

class MyOperationCollectionSample
{
   public static void Main()
   {
      try
      {
         // Read the 'MathService_Input_cs.wsdl' file.
         ServiceDescription myDescription =
                     ServiceDescription.Read("MathService_Input_cs.wsdl");
         PortTypeCollection myPortTypeCollection =myDescription.PortTypes;
         // Get the 'OperationCollection' for 'SOAP' protocol.
         OperationCollection myOperationCollection =
                                       myPortTypeCollection[0].Operations;
         Operation myOperation = new Operation();
         myOperation.Name = "Add";
         OperationMessage myOperationMessageInput =
                                  (OperationMessage) new OperationInput();
         myOperationMessageInput.Message = new XmlQualifiedName
                              ("AddSoapIn",myDescription.TargetNamespace);
         OperationMessage myOperationMessageOutput =
                                 (OperationMessage) new OperationOutput();
         myOperationMessageOutput.Message = new XmlQualifiedName(
                              "AddSoapOut",myDescription.TargetNamespace);
         myOperation.Messages.Add(myOperationMessageInput);
         myOperation.Messages.Add(myOperationMessageOutput);
         myOperationCollection.Add(myOperation);

         if(myOperationCollection.Contains(myOperation) == true)
         {
            Console.WriteLine("The index of the added 'myOperation' " +
                              "operation is : " +
                              myOperationCollection.IndexOf(myOperation));
         }

         myOperationCollection.Remove(myOperation);
         // Insert the 'myOpearation' operation at the index '0'.
         myOperationCollection.Insert(0, myOperation);
         Console.WriteLine("The operation at index '0' is : " +
                           myOperationCollection[0].Name);

         Operation[] myOperationArray = new Operation[
                                             myOperationCollection.Count];
         myOperationCollection.CopyTo(myOperationArray, 0);
         Console.WriteLine("The operation(s) in the collection are :");
         for(int i = 0; i < myOperationCollection.Count; i++)
         {
            Console.WriteLine(" " + myOperationArray[i].Name);
         }

         myDescription.Write("MathService_New_cs.wsdl");
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception caught!!!");
         Console.WriteLine("Source : " + e.Source);
         Console.WriteLine("Message : " + e.Message);
      }
   }
}
Option Strict On
Imports System.Web.Services
Imports System.Xml
Imports System.Web.Services.Description

Class MyOperationCollectionSample
   Public Shared Sub Main()
      Try
         ' Read the 'MathService_Input_vb.wsdl' file.
         Dim myDescription As ServiceDescription = _
                        ServiceDescription.Read("MathService_Input_vb.wsdl")
         Dim myPortTypeCollection As PortTypeCollection = _
                                                   myDescription.PortTypes
         ' Get the 'OperationCollection' for 'SOAP' protocol.
         Dim myOperationCollection As OperationCollection = _
                                         myPortTypeCollection(0).Operations
         Dim myOperation As New Operation()
         myOperation.Name = "Add"
         Dim myOperationMessageInput As OperationMessage = _
                              CType(New OperationInput(), OperationMessage)
         myOperationMessageInput.Message = New XmlQualifiedName _
                              ("AddSoapIn", myDescription.TargetNamespace)
         Dim myOperationMessageOutput As OperationMessage = _
                              CType(New OperationOutput(), OperationMessage)
         myOperationMessageOutput.Message = New XmlQualifiedName _
                              ("AddSoapOut", myDescription.TargetNamespace)
         myOperation.Messages.Add(myOperationMessageInput)
         myOperation.Messages.Add(myOperationMessageOutput)
         myOperationCollection.Add(myOperation)

         If myOperationCollection.Contains(myOperation) = True Then
            Console.WriteLine("The index of the added 'myOperation' " + _
                     "operation is : " + _
                     myOperationCollection.IndexOf(myOperation).ToString)
         End If

         myOperationCollection.Remove(myOperation)
         ' Insert the 'myOpearation' operation at the index '0'.
         myOperationCollection.Insert(0, myOperation)
         Console.WriteLine("The operation at index '0' is : " + _
                           myOperationCollection.Item(0).Name)

         Dim myOperationArray(myOperationCollection.Count) As Operation
         myOperationCollection.CopyTo(myOperationArray, 0)
         Console.WriteLine("The operation(s) in the collection are :")
         Dim i As Integer
         For i = 0 To myOperationCollection.Count - 1
            Console.WriteLine(" " + myOperationArray(i).Name)
         Next i

         myDescription.Write("MathService_New_vb.wsdl")
      Catch e As Exception
         Console.WriteLine("Exception caught!!!")
         Console.WriteLine("Source : " + e.Source)
         Console.WriteLine("Message : " + e.Message)
      End Try
   End Sub
End Class

Uwagi

Klasa Operation odpowiada elementowi WSDL (Web Services Description Language) <operation> ujętego <portType> w element . Aby uzyskać więcej informacji na temat języka WSDL, zobacz specyfikację WSDL .

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ść dla określonego Operation indeksu zerowego.

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(Operation)

Dodaje określony Operation element na końcu obiektu OperationCollection.

Clear()

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

(Odziedziczone po CollectionBase)
Contains(Operation)

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

CopyTo(Operation[], Int32)

Kopiuje całą OperationCollection do zgodnej jednowymiarowej tablicy typu Operation, 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)
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(Operation)

Wyszukuje określony Operation element i zwraca indeks oparty na zerze pierwszego wystąpienia w kolekcji.

Insert(Int32, Operation)

Dodaje określony Operation element do określonego indeksu OperationCollection opartego na zerze.

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(Operation)

Usuwa pierwsze wystąpienie określonego Operation elementu z .OperationCollection

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