次の方法で共有


OperationBindingCollection.Insert メソッド

OperationBindingCollection 内の指定した 0 から始まるインデックスに、指定した OperationBinding インスタンスを追加します。

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

パラメータ

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

解説

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

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

新しい要素を挿入できるように、挿入位置より後にある要素の位置が繰り下がります。

使用例

[Visual Basic, C#, C++] Insert メソッドを使用する例を次に示します。

 
' Insert the OperationBinding of the Add operation at index 0.
myOperationBindingCollection.Insert(0, addOperationBinding)
Console.WriteLine(ControlChars.NewLine & _
   "Inserted the OperationBinding of the " & _
   "Add operation in the collection.")

' Get the index of the OperationBinding of the Add
' operation from the collection.
Dim index As Integer = myOperationBindingCollection.IndexOf( _
   addOperationBinding)
Console.WriteLine(ControlChars.NewLine & _
   "The index of the OperationBinding of the " & _
   "Add operation : " & index.ToString())

[C#] 
// Insert the OperationBinding of the Add operation at index 0.
myOperationBindingCollection.Insert(0, addOperationBinding);
Console.WriteLine("\nInserted the OperationBinding of the " +
   "Add operation in the collection.");

// Get the index of the OperationBinding of the Add
// operation from the collection.
int index = myOperationBindingCollection.IndexOf(addOperationBinding);
Console.WriteLine("\nThe index of the OperationBinding of the " +
   "Add operation : " + index);

[C++] 
// Insert the OperationBinding of the Add operation at index 0.
myOperationBindingCollection->Insert(0, addOperationBinding);
Console::WriteLine(S"\nInserted the OperationBinding of the "
   S"Add operation in the collection.");

// Get the index of the OperationBinding of the Add
// operation from the collection.
int index = myOperationBindingCollection->IndexOf(addOperationBinding);
Console::WriteLine(S"\nThe index of the OperationBinding of the Add operation : {0}", __box(index));

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

参照

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