OperationBindingCollection.Insert(Int32, OperationBinding) 方法

定义

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

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

参数

index
Int32

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

bindingOperation
OperationBinding

OperationBinding要添加到集合中。

示例

下面的示例演示 Insert 方法的用法。

// 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 : {0}", index );
// 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);
' 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())

注解

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

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

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

适用于