ServiceDescriptionCollection.IndexOf Method (ServiceDescription)


Searches for the specified ServiceDescription and returns the zero-based index of the first occurrence within the collection.

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

public int IndexOf(
	ServiceDescription serviceDescription


Type: System.Web.Services.Description.ServiceDescription

The ServiceDescription for which to search in the collection.

Return Value

Type: System.Int32

The zero-based index of the specified service description, or -1 if the element was not found in the collection.

// Get the index of 'ServiceDescription' object.
int myIndex = myCollection.IndexOf(myServiceDescription2); 
// Remove 'ServiceDescription' object from the collection.
Console.WriteLine("Element at index {0} is removed ", myIndex);

.NET Framework
Available since 1.1
Return to top