MessageQueue.CanRead 屬性

定義

取得值,指出是否可讀取 MessageQueue

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

屬性值

如果 MessageQueue 存在而且應用程式可以從它讀取,則為 true,否則為 false

屬性

範例

下列程式代碼範例會顯示消息佇列 CanRead 的 屬性值。

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

備註

CanRead 指出應用程式是否能夠查看或接收來自佇列的訊息。 如果 CanReadtrueMessageQueue 可以從佇列接收或查看訊息。 否則,它就無法。

CanRead 如果 false 佇列已經以獨佔讀取存取權開啟 (,或已以非獨佔存取權開啟,且此 MessageQueue 佇列會要求獨佔存取) ,或應用程式沒有足夠的許可權存取。 如果您的應用程式在 為 falseCanRead嘗試從佇列讀取,則會拒絕存取。

下表顯示此屬性是否可在各種工作組模式中使用。

工作組模式 可用
本機電腦
本機計算機和直接格式名稱
遠端電腦
遠端電腦和直接格式名稱

適用於

另請參閱