次の方法で共有


ServiceDescriptionFormatExtensionCollection.Insert メソッド

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

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

パラメータ

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

例外

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

または

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

解説

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

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

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

使用例

 
' Insert 'MyFormatExtension' object.
myCollection.Insert(0, myFormatExtensionObject)
Console.WriteLine("'myFormatExtensionObject' is inserted to collection.")

[C#] 
// Insert 'MyFormatExtension' object.
myCollection.Insert(0,myFormatExtensionObject);
Console.WriteLine("'myFormatExtensionObject' is inserted to collection.");

[C++] 
// Insert 'MyFormatExtension' object.
myCollection->Insert(0, myFormatExtensionObject);
Console::WriteLine(S"'myFormatExtensionObject' is inserted to collection.");

[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 ファミリ

参照

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