MessagePartCollection.Add(MessagePart) 方法

定义

将指定的 MessagePart 添加到 MessagePartCollection 的结尾。

public:
 int Add(System::Web::Services::Description::MessagePart ^ messagePart);
public int Add (System.Web.Services.Description.MessagePart messagePart);
member this.Add : System.Web.Services.Description.MessagePart -> int
Public Function Add (messagePart As MessagePart) As Integer

参数

messagePart
MessagePart

要添加到集合中的 MessagePart

返回

Int32

添加了 messagePart 参数的位置的从零开始的索引。

示例

MessagePart^ myMessagePart = gcnew MessagePart;
myMessagePart->Name = "parameters";
myMessagePart->Element = gcnew XmlQualifiedName( "AddResponse",myServiceDescription->TargetNamespace );
myMessage->Parts->Add( myMessagePart );
MessagePart myMessagePart = new MessagePart();
myMessagePart.Name = "parameters";
myMessagePart.Element = new
   XmlQualifiedName("AddResponse",myServiceDescription.TargetNamespace);
myMessage.Parts.Add(myMessagePart);
Dim myMessagePart As New MessagePart()
myMessagePart.Name = "parameters"
myMessagePart.Element = New XmlQualifiedName("AddResponse", _
   myServiceDescription.TargetNamespace)
myMessage.Parts.Add(myMessagePart)

适用于