MessageQueue.CanRead MessageQueue.CanRead MessageQueue.CanRead MessageQueue.CanRead Property

定義

取得值,指出是否可讀取 MessageQueueGets a value that indicates whether the MessageQueue can be read.

public:
 property bool CanRead { bool get(); };
[System.ComponentModel.Browsable(false)]
[System.Messaging.MessagingDescription("MQ_CanRead")]
public bool CanRead { get; }
member this.CanRead : bool
Public ReadOnly Property CanRead As Boolean

屬性值

如果 MessageQueue 存在而且應用程式可以從它讀取,則為 true,否則為 falsetrue if the MessageQueue exists and the application can read from it; otherwise, false.

範例

下列程式碼範例會顯示訊息佇列的CanRead屬性值。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);

備註

CanRead指出應用程式是否能夠查看或接收來自佇列的訊息。CanRead indicates whether the application is able to peek or receive messages from the queue. 如果CanReadtrue,則MessageQueue可以接收或查看佇列中的訊息。If CanRead is true, the MessageQueue can receive or peek messages from the queue. 否則, 就不能這麼做。Otherwise, it cannot.

CanReadfalse是指佇列是否已經以獨佔讀取權限開啟 (或者, 如果它是以非獨佔存取權開啟, MessageQueue而這會要求獨佔存取權), 或應用程式沒有足夠的許可權來存取它。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. 如果您的應用程式在為CanRead false時嘗試從佇列讀取, 則會拒絕存取。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 可用Available
本機電腦Local computer Yes
本機電腦和直接格式名稱Local computer and direct format name Yes
遠端電腦Remote computer No
遠端電腦和直接格式名稱Remote computer and direct format name Yes

適用於

另請參閱