OperationMessageCollection.Insert(Int32, OperationMessage) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将指定的 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将添加到集合的末尾。
插入点下移以容纳新元素的元素。