ServiceDescriptionCollection.Contains(ServiceDescription) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回值,指出指定的 ServiceDescription 是否為集合的成員。
public:
bool Contains(System::Web::Services::Description::ServiceDescription ^ serviceDescription);
public bool Contains (System.Web.Services.Description.ServiceDescription serviceDescription);
member this.Contains : System.Web.Services.Description.ServiceDescription -> bool
Public Function Contains (serviceDescription As ServiceDescription) As Boolean
參數
- serviceDescription
- ServiceDescription
ServiceDescription,要為其檢查集合成員資格。
傳回
如果 serviceDescription
參數是 ServiceDescriptionCollection 的成員,則為 true
,否則為 false
。
範例
// Check for 'ServiceDescription' object in the collection.
if (myCollection.Contains(myServiceDescription2))
{
// 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);
}
else
{
Console.WriteLine("Element not found.");
}
' Check for 'ServiceDescription' object in the collection.
If myCollection.Contains(myServiceDescription2) Then
' 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())
Else
Console.WriteLine("Element not found.")
End If