Export (0) Print
Expand All

MessageQueue Constructor

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

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft