MessageQueueEnumerator 클래스

정의

앞으로만 이동 가능한 커서를 제공하여 메시지 큐에 있는 메시지를 열거합니다.

public ref class MessageQueueEnumerator : MarshalByRefObject, IDisposable, System::Collections::IEnumerator
public class MessageQueueEnumerator : MarshalByRefObject, IDisposable, System.Collections.IEnumerator
type MessageQueueEnumerator = class
    inherit MarshalByRefObject
    interface IEnumerator
    interface IDisposable
Public Class MessageQueueEnumerator
Inherits MarshalByRefObject
Implements IDisposable, IEnumerator
상속
MessageQueueEnumerator
구현

예제

다음 코드 예제에서는 네트워크의 모든 메시지 큐를 통해 반복 하 고 각 큐에 대 한 경로 검사 합니다. 마지막으로 네트워크에서 공개 큐의 수를 표시합니다.

#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();
}
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;
        }
    }
}
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


        
        ' 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

End Class

설명

사용 하 여 MessageQueueEnumerator 네트워크에서 큐를 사용 하 여 동적 상호 작용 합니다. 메서드를 통해 사용할 수는 MessageQueue 클래스 중 하나를 반환할 수는 MessageQueueEnumerator 시 큐 컬렉션 스냅샷을 포함 하는 배열 또는 큐의 동적 목록이 포함 된 지정 된 메서드가 호출 되었습니다.

네트워크에서 큐의 정의 된 순서가 있지 않습니다. 예를 들어, 컴퓨터, 레이블, 퍼블릭 또는 프라이빗 상태에서 정렬 되거나 다른 사용자에 액세스할 수 있는 조건을 하지 않습니다. MessageQueueEnumerator 동적 목록 헤드에 초기화 하는 커서입니다. 호출 하 여 열거형의 첫 번째 큐에 커서를 이동할 수 있습니다 MoveNext합니다. 열거자가 초기화 된 후 사용할 수 있습니다 MoveNext 나머지 큐 단계별로 진행 합니다.

여 뒤로 이동 하는 것이 불가능 한 MessageQueueEnumerator합니다. 커서는 큐 열거형에서 앞으로 이동 하는 것을 허용합니다. 호출할 수 있습니다 Reset 열거를 다시 설정 및 다시 시작 목록 부분에 커서를 놓습니다. 열거자는 동적 이므로 열거자에서 커서의 현재 위치 뒤에 추가 된 큐에 액세스할 수 있습니다. 큐 커서의 현재 위치 앞에 삽입 되는 첫 번째 호출 재설정 하지 않고 액세스할 수 없습니다.

속성

Current

열거형의 현재 MessageQueue를 가져옵니다.

LocatorHandle

네트워크에서 큐를 찾는 데 사용되는 네이티브 메시지 큐 핸들을 가져옵니다.

메서드

Close()

해당 열거자와 관련된 리소스를 삭제합니다.

CreateObjRef(Type)

원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
Dispose()

MessageQueueEnumerator에서 사용하는 모든 리소스를 해제합니다.

Dispose(Boolean)

MessageQueueEnumerator에서 사용하는 관리되지 않는 리소스를 해제하고, 관리되는 리소스를 선택적으로 해제할 수 있습니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
Finalize()

큐에서 보유하는 리소스를 해제합니다.

GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다.

(다음에서 상속됨 MarshalByRefObject)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
InitializeLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.

(다음에서 상속됨 MarshalByRefObject)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
MemberwiseClone(Boolean)

현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
MoveNext()

가능한 경우 해당 열거자를 열거형의 다음 큐로 이동합니다.

Reset()

커서가 열거형의 시작 부분을 가리키도록 다시 설정합니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

IEnumerator.Current

열거형의 현재 MessageQueue를 가져옵니다.

적용 대상

추가 정보