MessageQueueEnumerator クラス
アセンブリ: System.Messaging (system.messaging.dll 内)

Public Class MessageQueueEnumerator Inherits MarshalByRefObject Implements IEnumerator, IDisposable
public class MessageQueueEnumerator : MarshalByRefObject, IEnumerator, IDisposable
public class MessageQueueEnumerator extends MarshalByRefObject implements IEnumerator, IDisposable
public class MessageQueueEnumerator extends MarshalByRefObject implements IEnumerator, IDisposable

ネットワーク上でのキューとの動的な対話には MessageQueueEnumerator を使います。MessageQueue クラスを通じて使用できるメソッドは、キューの動的リストを含む MessageQueueEnumerator か、指定されたメソッドが呼び出された時点でのキューのコレクションのスナップショットを含む配列のいずれかを、返すことができます。
ネットワークでのキューの順序は定義されていません。たとえば、コンピュータ、ラベル、パブリック ステータス、プライベート ステータスなどのユーザーがアクセスできる基準によって、キューを順序付けることはできません。MessageQueueEnumerator はカーソルであり、初期化時に動的リストの先頭に配置されます。MoveNext を呼び出すことで、このカーソルを列挙体の最初のキューに移動させることができます。列挙子が初期化された後に、MoveNext を使って残りのキューを順に進んでいくことができます。
MessageQueueEnumerator で後方に移動することはできません。キュー列挙体の中では、カーソルは前方移動だけできます。しかし、Reset を呼び出すと、列挙体をリセットしてカーソルを再びリストの先頭に置くことができます。列挙子は動的であるため、カーソルの現在位置より後に追加されるキューには、列挙子によってアクセスできます。しかし、カーソルの現在位置よりも前に挿入されているキューにアクセスするには、最初に Reset を呼び出す必要があります。

ネットワーク上のすべてのメッセージ キューを反復処理し、各キューのパスを取得するコード例を次に示します。この例では最後に、ネットワーク上のパブリック キューの数を表示します。
Imports System Imports System.Messaging Public Class MyNewQueue ' Provides an entry point into the application. ' ' This example uses a cursor to step through the ' message queues and list the public queues on the ' network. Public Shared Sub Main() ' Create a new instance of the class. Dim myNewQueue As New MyNewQueue() ' Output the count of Lowest priority messages. myNewQueue.ListPublicQueues() Return End Sub 'Main ' Iterates through message queues and examines the ' path for each queue. Also displays the number of ' public queues on the network. Public Sub ListPublicQueues() ' Holds the count of private queues. Dim numberQueues As Int32 = 0 ' Get a cursor into the queues on the network. Dim myQueueEnumerator As MessageQueueEnumerator = _ MessageQueue.GetMessageQueueEnumerator() ' Move to the next queue and read its path. While myQueueEnumerator.MoveNext() ' Increase the count if the priority is Lowest. Console.WriteLine(myQueueEnumerator.Current.Path) numberQueues += 1 End While ' Display final count. Console.WriteLine(("Number of public queues: " + _ numberQueues.ToString())) Return End Sub 'ListPublicQueues End Class 'MyNewQueue
using System; using System.Messaging; namespace MyProject { /// <summary> /// Provides a container class for the example. /// </summary> public class MyNewQueue { //************************************************** // Provides an entry point into the application. // // This example uses a cursor to step through the // message queues and list the public queues on the // network. //************************************************** public static void Main() { // Create a new instance of the class. MyNewQueue myNewQueue = new MyNewQueue(); // Output the count of Lowest priority messages. myNewQueue.ListPublicQueues(); return; } //************************************************** // Iterates through message queues and examines the // path for each queue. Also displays the number of // public queues on the network. //************************************************** public void ListPublicQueues() { // Holds the count of private queues. uint numberQueues = 0; // Get a cursor into the queues on the network. MessageQueueEnumerator myQueueEnumerator = MessageQueue.GetMessageQueueEnumerator(); // Move to the next queue and read its path. while(myQueueEnumerator.MoveNext()) { // Increase the count if priority is Lowest. Console.WriteLine(myQueueEnumerator.Current.Path); numberQueues++; } // Display final count. Console.WriteLine("Number of public queues: " + numberQueues.ToString()); return; } } }
#using <System.dll> #using <System.Messaging.dll> using namespace System; using namespace System::Messaging; //************************************************** // Iterates through message queues and examines the // path for each queue. Also displays the number of // public queues on the network. //************************************************** void ListPublicQueues() { // Holds the count of private queues. int numberQueues = 0; // Get a cursor into the queues on the network. MessageQueueEnumerator^ myQueueEnumerator = MessageQueue::GetMessageQueueEnumerator(); // Move to the next queue and read its path. while ( myQueueEnumerator->MoveNext() ) { // Increase the count if priority is Lowest. Console::WriteLine( myQueueEnumerator->Current->Path ); numberQueues++; } // Display final count. Console::WriteLine( "Number of public queues: {0}", numberQueues ); return; } //************************************************** // Provides an entry point into the application. // // This example uses a cursor to step through the // message queues and list the public queues on the // network. //************************************************** int main() { // Output the count of Lowest priority messages. ListPublicQueues(); }
package MyProject; import System.*; import System.Messaging.*; /// <summary> /// Provides a container class for the example. /// </summary> public class MyNewQueue { //************************************************** // Provides an entry point into the application. // // This example uses a cursor to step through the // message queues and list the public queues on the // network. //************************************************** public static void main(String[] args) { // Create a new instance of the class. MyNewQueue myNewQueue = new MyNewQueue(); // Output the count of Lowest priority messages. myNewQueue.ListPublicQueues(); return; } //main //************************************************** // Iterates through message queues and examines the // path for each queue. Also displays the number of // public queues on the network. //************************************************** public void ListPublicQueues() { // Holds the count of private queues. long numberQueues = 0; // Get a cursor into the queues on the network. MessageQueueEnumerator myQueueEnumerator = MessageQueue.GetMessageQueueEnumerator(); // Move to the next queue and read its path. while (myQueueEnumerator.MoveNext()) { // Increase the count if priority is Lowest. Console.WriteLine(myQueueEnumerator.get_Current().get_Path()); numberQueues++; } // Display final count. Console.WriteLine("Number of public queues: " + ((Int32)numberQueues).ToString()); return; } //ListPublicQueues } //MyNewQueue

System.MarshalByRefObject
System.Messaging.MessageQueueEnumerator


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MessageQueueEnumerator メンバ
System.Messaging 名前空間
MessageQueue クラス
MessageQueue.GetMessageQueueEnumerator
MessageQueueEnumerator プロパティ

名前 | 説明 | |
---|---|---|
![]() | Current | 列挙体の現在の MessageQueue を取得します。 |
![]() | LocatorHandle | ネットワークでキューの位置を特定するのに使われるネイティブなメッセージ キュー ハンドルを取得します。 |

名前 | 説明 | |
---|---|---|
![]() | System.Collections.IEnumerator.Current | 列挙体の現在の MessageQueue を取得します。 |

関連項目
MessageQueueEnumerator クラスSystem.Messaging 名前空間
MessageQueue クラス
MessageQueue.GetMessageQueueEnumerator
MessageQueueEnumerator メソッド

名前 | 説明 | |
---|---|---|
![]() | Close | 列挙子と関連付けられたリソースを解放します。 |
![]() | CreateObjRef | リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。 ( MarshalByRefObject から継承されます。) |
![]() | Dispose | オーバーロードされます。 MessageQueueEnumerator によって使用されているリソースを解放します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetLifetimeService | 対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。 ( MarshalByRefObject から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | InitializeLifetimeService | 対象のインスタンスの有効期間ポリシーを制御する、有効期間サービス オブジェクトを取得します。 ( MarshalByRefObject から継承されます。) |
![]() | MoveNext | 列挙体の次のキューに列挙子を進めます (そのキューが現在使用できる場合)。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | Reset | 列挙体の先頭を指すようにカーソルをリセットします。 |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Dispose | オーバーロードされます。 MessageQueueEnumerator によって使用されているリソースを解放します。 |
![]() | Finalize | オーバーライドされます。 キューに保持されているリソースを解放します。 |
![]() | MemberwiseClone | オーバーロードされます。 ( MarshalByRefObject から継承されます。) |

関連項目
MessageQueueEnumerator クラスSystem.Messaging 名前空間
MessageQueue クラス
MessageQueue.GetMessageQueueEnumerator
MessageQueueEnumerator メンバ
メッセージ キュー内のメッセージを列挙するための前方向カーソルを提供します。
MessageQueueEnumerator データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | Current | 列挙体の現在の MessageQueue を取得します。 |
![]() | LocatorHandle | ネットワークでキューの位置を特定するのに使われるネイティブなメッセージ キュー ハンドルを取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Close | 列挙子と関連付けられたリソースを解放します。 |
![]() | CreateObjRef | リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。 (MarshalByRefObject から継承されます。) |
![]() | Dispose | オーバーロードされます。 MessageQueueEnumerator によって使用されているリソースを解放します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetLifetimeService | 対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | InitializeLifetimeService | 対象のインスタンスの有効期間ポリシーを制御する、有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。) |
![]() | MoveNext | 列挙体の次のキューに列挙子を進めます (そのキューが現在使用できる場合)。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | Reset | 列挙体の先頭を指すようにカーソルをリセットします。 |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Dispose | オーバーロードされます。 MessageQueueEnumerator によって使用されているリソースを解放します。 |
![]() | Finalize | オーバーライドされます。 キューに保持されているリソースを解放します。 |
![]() | MemberwiseClone | オーバーロードされます。 ( MarshalByRefObject から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | System.Collections.IEnumerator.Current | 列挙体の現在の MessageQueue を取得します。 |

関連項目
MessageQueueEnumerator クラスSystem.Messaging 名前空間
MessageQueue クラス
MessageQueue.GetMessageQueueEnumerator
- MessageQueueEnumeratorのページへのリンク