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