ServiceCollection::IndexOf Method (Service^)
.NET Framework (current version)
Searches for the specified Service and returns the zero-based index of the first occurrence within the ServiceCollection.
Assembly: System.Web.Services (in System.Web.Services.dll)
Parameters
- service
-
Type:
System.Web.Services.Description::Service^
The Service for which to search in the collection.
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
Available since 1.1
Show: