ערוך

שתף באמצעות


MessagePartCollection.Insert(Int32, MessagePart) Method

Definition

Adds the specified MessagePart to the MessagePartCollection at the specified zero-based index.

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

Parameters

index
Int32

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

messagePart
MessagePart

The MessagePart to add to the collection.

Examples

MessagePart^ myMessagePart1 = gcnew MessagePart;
myMessagePart1->Name = "parameters";
myMessagePart1->Element = gcnew XmlQualifiedName( "Add",myServiceDescription->TargetNamespace );
myMessage1->Parts->Insert( 0, myMessagePart1 );
MessagePart myMessagePart1 = new MessagePart();
myMessagePart1.Name = "parameters";
myMessagePart1.Element = new XmlQualifiedName("Add",myServiceDescription.TargetNamespace);
myMessage1.Parts.Insert(0,myMessagePart1);
Dim myMessagePart1 As New MessagePart()
myMessagePart1.Name = "parameters"
myMessagePart1.Element = New XmlQualifiedName("Add", _
   myServiceDescription.TargetNamespace)
myMessage1.Parts.Insert(0, myMessagePart1)

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 messagePart parameter is added to the end of the MessagePartCollection.

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

Applies to