共用方式為


MessageCollection.Add(Message) 方法

定義

將指定的 Message 加入至 MessageCollection 的結尾。

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

參數

message
Message

要加入至集合的 Message

傳回

已加入 message 參數處的以零起始的索引。

範例

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

適用於