MessageQueue Constructor (System.Messaging)

Switch View :
ScriptFree
.NET Framework Class Library
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)
Syntax

Visual Basic
Public Sub New
C#
public MessageQueue()
Visual C++
public:
MessageQueue()
F#
new : unit -> MessageQueue
Remarks

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

Examples

The following code example creates a new MessageQueue.

Visual Basic

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


C#

// 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";


Version Information

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
.NET Framework Security

Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Reference