MessageQueue Constructor ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes a new instance of the MessageQueue class. After the default constructor initializes the new instance, you must set the instance's Path property before you can use the instance.

Namespace:   System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)

public MessageQueue()

Use this overload to create a new instance of the MessageQueue class that is not immediately tied to a queue on the Message Queuing server. Before using this instance, you must connect it to an existing Message Queuing queue by setting the Path property. Alternatively, you can set the MessageQueue reference to the Create(String) method's return value, thereby creating a new Message Queuing queue.

The MessageQueue constructor instantiates a new instance of the MessageQueue class; it does not create a new Message Queuing queue.

The following table shows initial property values for an instance of MessageQueue.

Property

Initial value

DefaultPropertiesToSend

The values set by the default constructor of the DefaultPropertiesToSend class.

Formatter

XmlMessageFormatter

MessageReadPropertyFilter

The values set by the default constructor of the MessagePropertyFilter class. All the filter values are set to true.

DenySharedReceive

false

The following code example creates a new MessageQueue.

// Connect to a queue on the local computer. You must set the queue's
// Path property before you can use the queue.
MessageQueue queue = new MessageQueue();
queue.Path = ".\\exampleQueue";

.NET Framework
Available since 1.1
Return to top
Show: