語言

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"))

備註

如果集合中的項目數量已經等於集合容量,則在插入新元素前,會自動重新配置內部陣列,容量會加倍。

若indexCount參數等於 ,import則參數加於 末尾ImportCollection。

插入點之後的元素會向下移動以容納新元素。

適用於