MessagePartCollection.Insert(Int32, MessagePart) 方法

定义

将指定的 MessagePart 添加到 MessagePartCollection 中指定的从零开始的索引处。

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)

参数

index
Int32

将在该处插入 messagePart 参数的从零开始的索引。

messagePart
MessagePart

要添加到集合中的 MessagePart

示例

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)

注解

如果集合中的项数已等于集合的容量,则插入新元素之前自动重新分配内部数组来增加容量。

index如果参数等于Count,则参数messagePart将添加到末尾MessagePartCollection

插入点下移以容纳新元素的元素。

适用于