ServiceCollection::Contains Method (Service^)

 

Returns a value indicating whether the specified Service instance is a member of the ServiceCollection.

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

public:
bool Contains(
	Service^ service
)

Parameters

service
Type: System.Web.Services.Description::Service^

The Service for which to check collection membership.

Return Value

Type: System::Boolean

true if the service parameter is a member of the ServiceCollection; otherwise, false.

if ( myServiceDescription->Services->Contains( myService ) )
{
   Console::WriteLine( "The mentioned service exists at index {0} in the WSDL.", myServiceDescription->Services->IndexOf( myService ) );

   array<Service^>^myServiceArray = gcnew array<Service^>(myServiceDescription->Services->Count);

   // Copy the services into an array.
   myServiceDescription->Services->CopyTo( myServiceArray, 0 );
   IEnumerator^ myEnumerator = myServiceArray->GetEnumerator();
   Console::WriteLine( "The names of services in the array are" );
   while ( myEnumerator->MoveNext() )
   {
      Service^ myService1 = dynamic_cast<Service^>(myEnumerator->Current);
      Console::WriteLine( myService1->Name );
   }
}
else
{
   Console::WriteLine( "Service does not exist in the WSDL." );
}

.NET Framework
Available since 1.1
Return to top
Show: