This documentation is archived and is not being maintained.

Operation.Messages Property

Gets the collection of instances of the Message class defined by the current Operation.

[Visual Basic]
Public ReadOnly Property Messages As OperationMessageCollection
[C#]
public OperationMessageCollection Messages {get;}
[C++]
public: __property OperationMessageCollection* get_Messages();
[JScript]
public function get Messages() : OperationMessageCollection;

Property Value

An OperationMessageCollection.

Remarks

Because an Operation is associated with exactly one OperationInput and exactly one OperationOutput, only one instance of each can be a member of this collection, and thus the collection can have a maximum of two members.

Example

[Visual Basic] 
' Create an Operation.
Dim myOperation As New Operation()
myOperation.Name = myOperationName
Dim myInput As OperationMessage = _
   CType(New OperationInput(), OperationMessage)
myInput.Message = New XmlQualifiedName(myInputMesg)
Dim myOutput As OperationMessage = _
   CType(New OperationOutput(), OperationMessage)
myOutput.Message = New XmlQualifiedName(myOutputMesg)

' Add messages to the OperationMessageCollection.
myOperation.Messages.Add(myInput)
myOperation.Messages.Add(myOutput)
Console.WriteLine("Operation name is: " & myOperation.Name)

[C#] 
// Create an Operation.
Operation myOperation = new Operation();
myOperation.Name = myOperationName;
OperationMessage myInput = (OperationMessage)new OperationInput();
myInput.Message =  new XmlQualifiedName(myInputMesg);
OperationMessage myOutput = (OperationMessage)new OperationOutput();
myOutput.Message = new XmlQualifiedName(myOutputMesg);

// Add messages to the OperationMessageCollection.
myOperation.Messages.Add(myInput);
myOperation.Messages.Add(myOutput);
Console.WriteLine("Operation name is: " + myOperation.Name);     

[C++] 
// Create an Operation.
Operation* myOperation = new Operation();
myOperation->Name = myOperationName;
OperationMessage* myInput = dynamic_cast<OperationMessage*>(new OperationInput());
myInput->Message =  new XmlQualifiedName(myInputMesg);
OperationMessage* myOutput = dynamic_cast<OperationMessage*>(new OperationOutput());
myOutput->Message = new XmlQualifiedName(myOutputMesg);

// Add messages to the OperationMessageCollection.
myOperation->Messages->Add(myInput);
myOperation->Messages->Add(myOutput);
Console::WriteLine(S"Operation name is: {0}", myOperation->Name);     

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Operation Class | Operation Members | System.Web.Services.Description Namespace

Show: