This documentation is archived and is not being maintained.

ServiceCollection.Remove Method

Removes the first occurrence of the specified Service from the ServiceCollection.

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

Parameters

service
The Service 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 Service move up to occupy the vacated spot.

Example

[Visual Basic] 
' Read a ServiceDescription from existing WSDL.
Dim myServiceDescription As ServiceDescription = _
   ServiceDescription.Read("Input.vb.wsdl")
myServiceDescription.TargetNamespace = "http://tempuri.org/"

' Get the ServiceCollection of the ServiceDescription.
Dim myServiceCollection As ServiceCollection = _
   myServiceDescription.Services

' Remove the Service at index 0 of the collection.
myServiceCollection.Remove(myServiceDescription.Services.Item(0))

[C#] 
// Read a ServiceDescription from existing WSDL.
ServiceDescription myServiceDescription =
   ServiceDescription.Read("Input_CS.wsdl");
myServiceDescription.TargetNamespace = "http://tempuri.org/";

// Get the ServiceCollection of the ServiceDescription.
ServiceCollection myServiceCollection = myServiceDescription.Services;

// Remove the Service at index 0 of the collection.
myServiceCollection.Remove(myServiceDescription.Services[0]);

[C++] 
// Read a ServiceDescription from existing WSDL.
ServiceDescription* myServiceDescription =
   ServiceDescription::Read(S"Input_CS.wsdl");
myServiceDescription->TargetNamespace = S"http://tempuri.org/";

// Get the ServiceCollection of the ServiceDescription.
ServiceCollection* myServiceCollection = myServiceDescription->Services;

// Remove the Service at index 0 of the collection.
myServiceCollection->Remove(myServiceDescription->Services->Item[0]);

[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

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

Show: