This documentation is archived and is not being maintained.

ImportCollection.Insert Method

Adds the specified Import instance to the ImportCollection at the specified zero-based index.

[Visual Basic]
Public Sub Insert( _
   ByVal index As Integer, _
   ByVal import As Import _
)
[C#]
public void Insert(
 int index,
 Import import
);
[C++]
public: void Insert(
 int index,
 Import* import
);
[JScript]
public function Insert(
   index : int,
 import : Import
);

Parameters

index
The zero-based index at which to insert the import parameter.
import
The Import to add to the collection.

Exceptions

Exception Type Condition
IndexOutOfRangeException The index parameter is less than zero.

- or -

The index parameter is greater than Count.

Remarks

If the number of items in the collection already equals the collection's capacity, the capacity is doubled by automatically reallocating the internal array before the new element is inserted.

If the index parameter is equal to Count, the import parameter is added to the end of the ImportCollection.

The elements after the insertion point move down to accommodate the new element.

Example

[Visual Basic, C#, C++] The following example demonstrates the use of the Insert method. To view the source for the user-defined CreateImport method, see the example included with the Import class.

[Visual Basic] 
myServiceDescription = _
   ServiceDescription.Read("StockQuoteService_vb.wsdl")
      myServiceDescription.Imports.Insert(0, _
 CreateImport("http://localhost/stockquote/definitions", _
 "http://localhost/stockquote/stockquote_vb.wsdl"))

[C#] 
myServiceDescription = 
   ServiceDescription.Read("StockQuoteService_cs.wsdl");
myServiceDescription.Imports.Insert(
   0,CreateImport("http://localhost/stockquote/definitions",
   "http://localhost/stockquote/stockquote_cs.wsdl"));

[C++] 
myServiceDescription = 
   ServiceDescription::Read(S"StockQuoteService_cpp.wsdl");
myServiceDescription->Imports->Insert(0, 
   CreateImport(S"http://localhost/stockquote/definitions", 
   S"http://localhost/stockquote/stockquote_cpp.wsdl"));

[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

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

Show: