ImportCollection.Insert(Int32, Import) 方法

定义

将指定的 Import 实例添加到 ImportCollection 从零开始的指定索引处。

public:
 void Insert(int index, System::Web::Services::Description::Import ^ import);
public void Insert(int index, System.Web.Services.Description.Import import);
member this.Insert : int * System.Web.Services.Description.Import -> unit
Public Sub Insert (index As Integer, import As Import)

参数

index
Int32

要插入参数的从零开始的 import 索引。

import
Import

Import要添加到集合中。

例外

参数 index 小于零。

-或-

参数 index 大于 Count.

示例

下面的示例演示 Insert 方法的用法。 若要查看用户定义的 CreateImport 方法的源,请参阅类中包含的 Import 示例。

myServiceDescription = ServiceDescription::Read( "StockQuoteService_cpp.wsdl" );
myServiceDescription->Imports->Insert( 0, CreateImport( "http://localhost/stockquote/definitions", "http://localhost/stockquote/stockquote_cpp.wsdl" ) );
myServiceDescription =
   ServiceDescription.Read("StockQuoteService_cs.wsdl");
myServiceDescription.Imports.Insert(
   0,CreateImport("http://localhost/stockquote/definitions",
   "http://localhost/stockquote/stockquote_cs.wsdl"));
  myServiceDescription = _
     ServiceDescription.Read("StockQuoteService_vb.wsdl")
myServiceDescription.Imports.Insert(0, _
   CreateImport("http://localhost/stockquote/definitions", _
   "http://localhost/stockquote/stockquote_vb.wsdl"))

注解

如果集合中的项数已等于集合的容量,则插入新元素之前,通过自动重新分配内部数组来增加容量。

index如果参数等于Count,则参数import将添加到该ImportCollection参数的末尾。

插入点下移以容纳新元素的元素。

适用于