ServiceDescriptionCollection.Remove(ServiceDescription) 方法

定义

从集合中移除指定的 ServiceDescription 的第一个匹配项。

public:
 void Remove(System::Web::Services::Description::ServiceDescription ^ serviceDescription);
public void Remove (System.Web.Services.Description.ServiceDescription serviceDescription);
member this.Remove : System.Web.Services.Description.ServiceDescription -> unit
Public Sub Remove (serviceDescription As ServiceDescription)

参数

serviceDescription
ServiceDescription

要从该集合中移除的 ServiceDescription

示例

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

注解

此方法执行线性搜索;因此,平均执行时间是 Count成正比的。

删除 ServiceDescription 后的元素向上移动以占用空置的位置。

适用于