CanRead Property

MessageQueue.CanRead Property

Gets a value that indicates whether the MessageQueue can be read.

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

public bool CanRead { get; }
/** @property */
public boolean get_CanRead ()

public function get CanRead () : boolean

Property Value

true if the MessageQueue exists and the application can read from it; otherwise, false.

CanRead indicates whether the application is able to peek or receive messages from the queue. If CanRead is true, the MessageQueue can receive or peek messages from the queue. Otherwise, it cannot.

CanRead is false if a queue is already open with exclusive read access (or if it's open with non-exclusive access and this MessageQueue requests exclusive access), or if the application does not have sufficient rights to access it. If your application tries to read from a queue when CanRead is false, access is denied.

The following table shows whether this property is available in various Workgroup modes.

Workgroup mode


Local computer


Local computer and direct format name


Remote computer


Remote computer and direct format name


The following code example displays the value of a message queue's CanRead property.

// Display the value of the queue's CanRead property.
Console.WriteLine("MessageQueue.CanRead: {0}", queue.CanRead);

// Display the value of the queue's CanRead property.
Console.WriteLine("MessageQueue.CanRead: {0}", 

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions

© 2016 Microsoft