共用方式為


ServiceDescriptionCollection.IndexOf(ServiceDescription) 方法

定義

搜尋指定的 ServiceDescription,並傳回集合中第一個符合項目之以零起始的索引。

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

參數

serviceDescription
ServiceDescription

ServiceDescription,要在集合中搜尋它。

傳回

Int32

指定的服務描述的以零起始的索引;如果在集合中找不到此項目,則為 -1。

範例

// 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())

適用於