ImportCollection.Remove Method

Removes the first occurrence of the specified Import from the ImportCollection.

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)

public:
void Remove (
	Import^ import
)
public void Remove (
	Import import
)
public function Remove (
	import : Import
)
Not applicable.

Parameters

import

The Import to remove from the collection.

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

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

The following example demonstrates the use of the Remove method.

// Get Import by Index.
Import^ myImport = myServiceDescription->Imports[ myServiceDescription->Imports->Count - 1 ];
Console::WriteLine( "Import by Index..." );
if ( myImportCollection->Contains( myImport ) )
{
   Console::WriteLine( "Import Namespace ' {0} ' is found in 'ImportCollection'.", myImport->Namespace );
   Console::WriteLine( "Index of '{0}' in 'ImportCollection' = {1}",
      myImport->Namespace, myImportCollection->IndexOf( myImport ) );
   Console::WriteLine( "Deleting Import from 'ImportCollection'..." );
   myImportCollection->Remove( myImport );
   if ( myImportCollection->IndexOf( myImport ) == -1 )
         Console::WriteLine( "Import is successfully removed from Import Collection." );
}

// Get Import by Index.
Import myImport = myServiceDescription.get_Imports().
    get_Item(myServiceDescription.get_Imports().get_Count() - 1);

Console.WriteLine("Import by Index...");
if (myImportCollection.Contains(myImport)) {
    Console.WriteLine("Import Namespace '" + myImport.get_Namespace() 
        + "' is found in 'ImportCollection'.");
    Console.WriteLine("Index of '" + myImport.get_Namespace() 
        + "' in 'ImportCollection' = " 
        + myImportCollection.IndexOf(myImport));
    Console.WriteLine("Deleting Import from 'ImportCollection'...");
    myImportCollection.Remove(myImport);
    if (myImportCollection.IndexOf(myImport) == -1) {
        Console.WriteLine(
            "Import is successfully removed from Import Collection.");
    }
}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: