This documentation is archived and is not being maintained.

FaultBindingCollection::Contains Method

Returns a value indicating whether the specified FaultBinding is a member of the FaultBindingCollection.

Namespace:  System.Web.Services.Description
Assembly:  System.Web.Services (in System.Web.Services.dll)

public:
bool Contains(
	FaultBinding^ bindingOperationFault
)

Parameters

bindingOperationFault
Type: System.Web.Services.Description::FaultBinding
The FaultBinding for which to check collection membership.

Return Value

Type: System::Boolean
true if the bindingOperationFault parameter is a member of the FaultBindingCollection; otherwise, false.

The following example demonstrates a typical use of the Contains method.


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

// Reverse the fault bindings 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 binding instances in the fault binding collection.
   for ( int i = 0; i < myFaultBindingArray->Length; i++ )
      myFaultBindingCollection->Remove( myFaultBindingArray[ i ] );

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

   // Check if the first element in the collection before the reversal is now the last element.
   if ( myFaultBindingCollection->Contains( myFaultBinding ) && myFaultBindingCollection->IndexOf( myFaultBinding ) == (myFaultBindingCollection->Count - 1) )

   // Display the WSDL generated to the console.
   myServiceDescription->Write( Console::Out );
   else
         Console::WriteLine( "Error while reversing" );
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: