This documentation is archived and is not being maintained.

ServiceDescriptionCollection.Remove Method

Removes the first occurrence of the specified ServiceDescription from the collection.

[Visual Basic]
Public Sub Remove( _
   ByVal serviceDescription As ServiceDescription _
)
[C#]
public void Remove(
 ServiceDescription serviceDescription
);
[C++]
public: void Remove(
 ServiceDescription* serviceDescription
);
[JScript]
public function Remove(
   serviceDescription : ServiceDescription
);

Parameters

serviceDescription
The ServiceDescription to remove from the collection.

Remarks

This method performs a linear search; therefore, the average execution time is proportional to Count.

The elements that follow the removed ServiceDescription move up to occupy the vacated spot.

Example

[Visual Basic] 
' Get the index of a ServiceDescription.
Dim myIndex As Integer = myCollection.IndexOf(myServiceDescription2)

' Remove a ServiceDescription from the collection.
myCollection.Remove(myServiceDescription2)
Console.WriteLine("Element at index {0} is removed.", _
   myIndex.ToString())

[C#] 
// Get the index of a ServiceDescription.
int myIndex = myCollection.IndexOf(myServiceDescription2);
 
// Remove a ServiceDescription from the collection.
myCollection.Remove(myServiceDescription2);
Console.WriteLine("Element at index {0} is removed.", myIndex);

[C++] 
// Get the index of 'ServiceDescription' object.
int myIndex = myCollection->IndexOf(myServiceDescription2);
// Remove 'ServiceDescription' object from the collection.
myCollection->Remove(myServiceDescription2);
Console::WriteLine(S"Element at index {0} is removed ",__box( myIndex));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ServiceDescriptionCollection Class | ServiceDescriptionCollection Members | System.Web.Services.Description Namespace

Show: