OperationFaultCollection Klasa

Definicja

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

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

Przykłady

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

using namespace System;
using namespace System::Web::Services::Description;
int main()
{
   try
   {
      // Read the StockQuote.wsdl file as input.
      ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" );

      PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes;
      PortType^ myPortType = myPortTypeCollection[ 0 ];
      OperationCollection^ myOperationCollection = myPortType->Operations;
      Operation^ myOperation = myOperationCollection[ 0 ];
      OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults;

      // Reverse the operation fault order.
      if ( myOperationFaultCollection->Count > 1 )
      {
         OperationFault^ myOperationFault = myOperationFaultCollection[ 0 ];
         array<OperationFault^>^myOperationFaultArray = gcnew array<OperationFault^>(myOperationFaultCollection->Count);

         // Copy the operation fault to a temporary array.
         myOperationFaultCollection->CopyTo( myOperationFaultArray, 0 );

         // Remove all the operation faults from the collection.
         for ( int i = 0; i < myOperationFaultArray->Length; i++ )
            myOperationFaultCollection->Remove( myOperationFaultArray[ i ] );

         // Insert the operation faults in the reverse order.
         for ( int i = 0,j = (myOperationFaultArray->Length - 1); i < myOperationFaultArray->Length; i++,j-- )
            myOperationFaultCollection->Insert( i, myOperationFaultArray[ j ] );
         if ( myOperationFaultCollection->Contains( myOperationFault ) && (myOperationFaultCollection->IndexOf( myOperationFault ) == myOperationFaultCollection->Count - 1) )
                  Console::WriteLine( "Succeeded in reversing the operation faults." );
         else
                  Console::WriteLine( "Error while reversing the faults." );
      }

      BindingCollection^ myBindingCollection = myServiceDescription->Bindings;
      Binding^ myBinding = myBindingCollection[ 0 ];
      OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations;
      OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ];
      FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults;

      // Reverse the fault binding order.
      if ( myFaultBindingCollection->Count > 1 )
      {
         FaultBinding^ myFaultBinding = myFaultBindingCollection[ 0 ];
         array<FaultBinding^>^myFaultBindingArray = gcnew array<FaultBinding^>(myFaultBindingCollection->Count);

         // Copy the fault bindings to a temporary array.
         myFaultBindingCollection->CopyTo( myFaultBindingArray, 0 );

         // Remove all the fault bindings.
         for ( int i = 0; i < myFaultBindingArray->Length; i++ )
            myFaultBindingCollection->Remove( myFaultBindingArray[ i ] );

         // Insert the fault bindings in the reverse order.
         for ( int i = 0,j = (myFaultBindingArray->Length - 1); i < myFaultBindingArray->Length; i++,j-- )
            myFaultBindingCollection->Insert( i, myFaultBindingArray[ j ] );

         // Check whether the first element before the reversal 
         // is now the last element.
         if ( myFaultBindingCollection->Contains( myFaultBinding ) && myFaultBindingCollection->IndexOf( myFaultBinding ) == (myFaultBindingCollection->Count - 1) )
         {
            // Write the WSDL generated to a file.
            myServiceDescription->Write( "StockQuoteOut_cpp.wsdl" );
            Console::WriteLine( "The file StockQuoteOut_cpp.wsdl was successfully written" );
         }
         else
            Console::WriteLine( "An error occurred while reversing the input WSDL file." );
      }
   }
   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.Description;

public class MyOperationFaultCollectionSample
{
   public static void Main()
   {
      try
      {
         // Read the StockQuote.wsdl file as input.
         ServiceDescription myServiceDescription =
            ServiceDescription.Read("StockQuote_cs.wsdl");
         PortTypeCollection myPortTypeCollection =
            myServiceDescription.PortTypes;
         PortType myPortType = myPortTypeCollection[0];
         OperationCollection myOperationCollection = myPortType.Operations;
         Operation myOperation = myOperationCollection[0];
         OperationFaultCollection myOperationFaultCollection =
            myOperation.Faults;

         // Reverse the operation fault order.
         if(myOperationFaultCollection.Count > 1)
         {
            OperationFault myOperationFault = myOperationFaultCollection[0];
            OperationFault[] myOperationFaultArray =
               new OperationFault[myOperationFaultCollection.Count];

            // Copy the operation faults to a temporary array.
            myOperationFaultCollection.CopyTo(myOperationFaultArray, 0);

            // Remove all the operation faults from the collection.
            for(int i = 0; i < myOperationFaultArray.Length; i++)
            {
               myOperationFaultCollection.Remove(myOperationFaultArray[i]);
            }

            // Insert the operation faults in the reverse order.
            for(int i = 0, j = (myOperationFaultArray.Length - 1);
               i < myOperationFaultArray.Length; i++, j--)
            {
               myOperationFaultCollection.Insert(
                  i, myOperationFaultArray[j]);
            }
            if ( myOperationFaultCollection.Contains(myOperationFault) &&
               (myOperationFaultCollection.IndexOf(myOperationFault)
               == myOperationFaultCollection.Count-1))
            {
               Console.WriteLine(
                  "Succeeded in reversing the operation faults.");
            }
            else
            {
               Console.WriteLine("Error while reversing the faults.");
            }
         }
         BindingCollection myBindingCollection =
            myServiceDescription.Bindings;
         Binding myBinding = myBindingCollection[0];
         OperationBindingCollection myOperationBindingCollection =
            myBinding.Operations;
         OperationBinding myOperationBinding =
            myOperationBindingCollection[0];
         FaultBindingCollection myFaultBindingCollection =
            myOperationBinding.Faults;

         // Reverse the fault binding order.
         if(myFaultBindingCollection.Count > 1)
         {
            FaultBinding myFaultBinding = myFaultBindingCollection[0];

            FaultBinding[] myFaultBindingArray =
               new FaultBinding[myFaultBindingCollection.Count];

            // Copy the fault bindings to a temporary array.
            myFaultBindingCollection.CopyTo(myFaultBindingArray, 0);

            // Remove all the fault bindings.
            for(int i = 0; i < myFaultBindingArray.Length; i++)
            {
               myFaultBindingCollection.Remove(myFaultBindingArray[i]);
            }

            // Insert the fault bindings in the reverse order.
            for(int i = 0, j = (myFaultBindingArray.Length - 1);
               i < myFaultBindingArray.Length; i++, j--)
            {
               myFaultBindingCollection.Insert(i, myFaultBindingArray[j]);
            }

            // Check whether the first element before the reversal
            // is now the last element.
            if(myFaultBindingCollection.Contains(myFaultBinding) &&
               myFaultBindingCollection.IndexOf(myFaultBinding) ==
               (myFaultBindingCollection.Count - 1))
            {
               // Write the WSDL generated to a file.
               myServiceDescription.Write("StockQuoteOut_cs.wsdl");
               Console.WriteLine(
                  "The file StockQuoteOut_cs.wsdl was successfully written.");
            }
            else
            {
               Console.WriteLine(
                  "An error occurred while reversing the input WSDL file.");
            }
         }
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception caught!!!");
         Console.WriteLine("Source : " + e.Source);
         Console.WriteLine("Message : " + e.Message);
      }
   }
}
Imports System.Web.Services.Description

Public Class MyOperationFaultCollectionSample
   
   Public Shared Sub Main()
      Try
         ' Read the StockQuote.wsdl file as input.
         Dim myServiceDescription As ServiceDescription = _
            ServiceDescription.Read("StockQuote_vb.wsdl")
         Dim myPortTypeCollection As PortTypeCollection = _
            myServiceDescription.PortTypes
         Dim myPortType As PortType = myPortTypeCollection(0)
         Dim myOperationCollection As OperationCollection = _
            myPortType.Operations
         Dim myOperation As Operation = myOperationCollection(0)
         Dim myOperationFaultCollection As OperationFaultCollection = _
            myOperation.Faults

         ' Reverse the operation fault order.
         If myOperationFaultCollection.Count > 1 Then
            Dim myOperationFault As OperationFault = _
               myOperationFaultCollection(0)
            Dim myOperationFaultArray(myOperationFaultCollection.Count -1 ) _
               As OperationFault

            ' Copy the operation faults to a temporary array.
            myOperationFaultCollection.CopyTo(myOperationFaultArray, 0)

            ' Remove all the operation faults from the collection.
            Dim i As Integer
            For i = 0 To myOperationFaultArray.Length - 1
               myOperationFaultCollection.Remove(myOperationFaultArray(i))
            Next i

            ' Insert the operation faults in the reverse order.
            Dim j As Integer = myOperationFaultArray.Length - 1
            i = 0
            While i < myOperationFaultArray.Length
               myOperationFaultCollection.Insert(i, myOperationFaultArray(j))
               i += 1
               j -= 1
            End While
            If myOperationFaultCollection.Contains(myOperationFault) And _
               myOperationFaultCollection.IndexOf(myOperationFault) = _
               myOperationFaultCollection.Count - 1 Then
               Console.WriteLine("Succeeded in reversing the operation faults.")
            Else
               Console.WriteLine("Error while reversing the faults.")
            End If
         End If
         Dim myBindingCollection As BindingCollection = _
            myServiceDescription.Bindings
         Dim myBinding As Binding = myBindingCollection(0)
         Dim myOperationBindingCollection As OperationBindingCollection = _
            myBinding.Operations
         Dim myOperationBinding As OperationBinding = _
            myOperationBindingCollection(0)
         Dim myFaultBindingCollection As FaultBindingCollection = _
            myOperationBinding.Faults
         
         ' Reverse the fault binding order.
         If myFaultBindingCollection.Count > 1 Then
            Dim myFaultBinding As FaultBinding = myFaultBindingCollection(0)
            
            Dim myFaultBindingArray(myFaultBindingCollection.Count -1 ) _
               As FaultBinding

            ' Copy the fault bindings to a temporary array.
            myFaultBindingCollection.CopyTo(myFaultBindingArray, 0)
            
            ' Remove all the fault bindings.
            Dim i As Integer
            For i = 0 To myFaultBindingArray.Length - 1
               myFaultBindingCollection.Remove(myFaultBindingArray(i))
            Next i

            Dim j As Integer = myFaultBindingArray.Length - 1
            i = 0

            ' Insert the fault bindings in the reverse order.
            While i < myFaultBindingArray.Length
               myFaultBindingCollection.Insert(i, myFaultBindingArray(j))
               i += 1
               j -= 1
            End While
 
            ' Check whether the first element before the reversal 
            ' is now the last element.
            If myFaultBindingCollection.Contains(myFaultBinding) And _
               myFaultBindingCollection.IndexOf(myFaultBinding) = _
               myFaultBindingCollection.Count - 1 Then

               ' Write the WSDL generated to a file.
               myServiceDescription.Write("StockQuoteOut_vb.wsdl")
               Console.WriteLine( _
                  "The file StockQuoteOut_vb.wsdl was successfully written.")
            Else
               Console.WriteLine( _
                  "An Error occurred while reversing the input WSDL file.")
            End If
         End If
      Catch e As Exception
         Console.WriteLine("Exception caught!!!")
         Console.WriteLine("Source : " & e.Source.ToString())
         Console.WriteLine("Message : " & e.Message.ToString())
      End Try
   End Sub
End Class

Uwagi

Klasa OperationFault odpowiada elementowi WSDL (Web Services Description Language) <fault> ujętemu <operation> w element, który jest z kolei ujęta w <portType> 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 OperationFault indeksu zerowego.

Item[String]

Pobiera element OperationFault według jego nazwy.

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

Dodaje określony OperationFault element na końcu obiektu OperationFaultCollection.

Clear()

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

(Odziedziczone po CollectionBase)
Contains(OperationFault)

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

CopyTo(OperationFault[], Int32)

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

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

Insert(Int32, OperationFault)

Dodaje określony OperationFault element do określonego indeksu OperationFaultCollection 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(OperationFault)

Usuwa pierwsze wystąpienie określonego OperationFault elementu z .OperationFaultCollection

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