OperationMessageCollection.Insert(Int32, OperationMessage) 方法

定义

将指定的 OperationMessage 添加到 OperationMessageCollection 中指定的从零开始的索引处。

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

参数

index
Int32

将在该处插入 operationMessage 参数的从零开始的索引。

operationMessage
OperationMessage

要添加到集合中的 OperationMessage

示例

myOperationMessageCollection->Remove( myInputOperationMessage );

// Display Flow, Input, and Output after removing.
DisplayFlowInputOutput( myOperationMessageCollection, "Remove" );

// Insert the message at index 0 in the collection.
myOperationMessageCollection->Insert( 0, myInputOperationMessage );

// Display Flow, Input, and Output after inserting.
DisplayFlowInputOutput( myOperationMessageCollection, "Insert" );
myOperationMessageCollection.Remove(myInputOperationMessage);

// Display Flow, Input, and Output after removing.
DisplayFlowInputOutput(myOperationMessageCollection, "Remove");

// Insert the message at index 0 in the collection.
myOperationMessageCollection.Insert(0, myInputOperationMessage);

// Display Flow, Input, and Output after inserting.
DisplayFlowInputOutput(myOperationMessageCollection, "Insert");
myOperationMessageCollection.Remove(myInputOperationMessage)

' Display Flow, Input, and Output after removing.
DisplayFlowInputOutput(myOperationMessageCollection, "Remove")

' Insert the message at index 0 in the collection.
myOperationMessageCollection.Insert(0, myInputOperationMessage)

' Display Flow, Input, and Output after inserting.
DisplayFlowInputOutput(myOperationMessageCollection, "Insert")

注解

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

index如果参数等于Count,则operationMessage参数将添加到集合的末尾。

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

适用于