NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Message Constructor

Initializes a new instance of the Message class.

Overload List

Initializes a new instance of the Message class with an empty body.

[Visual Basic] Overloads Public Sub New()
[C#] public Message();
[C++] public: Message();
[JScript] public function Message();

Initializes a new instance of the Message class, serializing the object passed as an argument.

[Visual Basic] Overloads Public Sub New(Object)
[C#] public Message(Object);
[C++] public: Message(Object*);
[JScript] public function Message(Object);

Example [Visual Basic]

The following example creates an message with the body "New Message." The example then sends the message to a queue. It assumes there is a queue on the computer "myComputer" with the name "myQueue".

Import the System.Messaging namespace for this example.

Note   This example shows how to use one of the overloaded version of the Message constructor. For other examples that may be available, see the individual overload topics.

[Visual Basic]

Private Sub CreateMessage()
    'Declare a message and message queue
    Dim msg As Message
    Dim mq As MessageQueue
    
    'Instantiate a message with the given body.
    msg = New Message("New Message.")
   
    'Instantiate a new MessageQueue object
    mq = New MessageQueue("myComputer\myQueue")

    'Send the message to the queue.
    mq.Send(msg)
End Sub

See Also

Message Class | Message Members | System.Messaging Namespace