共用方式為


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

傳回

已加入 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)

適用於