編輯

共用方式為


ServiceDescriptionCollection.IndexOf(ServiceDescription) Method

Definition

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

public:
 int IndexOf(System::Web::Services::Description::ServiceDescription ^ serviceDescription);
public int IndexOf (System.Web.Services.Description.ServiceDescription serviceDescription);
member this.IndexOf : System.Web.Services.Description.ServiceDescription -> int
Public Function IndexOf (serviceDescription As ServiceDescription) As Integer

Parameters

serviceDescription
ServiceDescription

The ServiceDescription for which to search in the collection.

Returns

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

Examples

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

Applies to