Edytuj

Udostępnij za pośrednictwem


OperationMessageCollection.Insert(Int32, OperationMessage) Method

Definition

Adds the specified OperationMessage to the OperationMessageCollection at the specified zero-based index.

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)

Parameters

index
Int32

The zero-based index at which to insert the operationMessage parameter.

operationMessage
OperationMessage

The OperationMessage to add to the collection.

Examples

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")

Remarks

If the number of items in the collection already equals the collection's capacity, the capacity is doubled by automatically reallocating the internal array before the new element is inserted.

If the index parameter is equal to Count, the operationMessage parameter is added to the end of the collection.

The elements after the insertion point move down to accommodate the new element.

Applies to