語言

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 則該參數會加到集合的末尾。

插入點之後的元素會向下移動以容納新元素。

適用於