次の方法で共有


ImportCollection.Insert メソッド

指定した 0 から始まるインデックス番号にある ImportCollection に、指定した Import インスタンスを追加します。

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

パラメータ

  • index
    import パラメータを挿入する位置の、0 から始まるインデックス番号。
  • import
    コレクションに追加する Import

例外

例外の種類 条件
IndexOutOfRangeException index パラメータが 0 未満です。

または

index パラメータが Count より大きい値です。

解説

コレクション内の項目数が既にコレクションの許容量に達している場合は、新しい要素が挿入される前に、内部配列を自動的に再割り当てすることによってコレクションの容量が 2 倍になります。

index パラメータと Count が等しい場合は、 import パラメータが ImportCollection の末尾に追加されます。

新しい要素を挿入するために、挿入位置より後にある要素の位置が繰り下げられます。

使用例

[Visual Basic, C#, C++] Insert メソッドを使用する例を次に示します。ユーザー定義の CreateImport メソッドのソースを確認するには、 Import クラスの例を参照してください。

 
myServiceDescription = _
   ServiceDescription.Read("StockQuoteService_vb.wsdl")
      myServiceDescription.Imports.Insert(0, _
 CreateImport("https://localhost/stockquote/definitions", _
 "https://localhost/stockquote/stockquote_vb.wsdl"))

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

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

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

ImportCollection クラス | ImportCollection メンバ | System.Web.Services.Description 名前空間