MessagePartCollection.Insert(Int32, MessagePart) Method

Definition

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

C#
public void Insert(int index, System.Web.Services.Description.MessagePart 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

C#
MessagePart myMessagePart1 = 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

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)