MessageQueue.GetEnumerator Метод
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Внимание!
This method returns a MessageEnumerator that implements RemoveCurrent family of methods incorrectly. Please use GetMessageEnumerator2 instead.
Перечисляет сообщения в очереди. Параметр GetEnumerator() использовать не рекомендуется. Вместо него следует использовать метод GetMessageEnumerator2().
public:
virtual System::Collections::IEnumerator ^ GetEnumerator();
public System.Collections.IEnumerator GetEnumerator ();
[System.Obsolete("This method returns a MessageEnumerator that implements RemoveCurrent family of methods incorrectly. Please use GetMessageEnumerator2 instead.")]
public System.Collections.IEnumerator GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.IEnumerator
override this.GetEnumerator : unit -> System.Collections.IEnumerator
[<System.Obsolete("This method returns a MessageEnumerator that implements RemoveCurrent family of methods incorrectly. Please use GetMessageEnumerator2 instead.")>]
abstract member GetEnumerator : unit -> System.Collections.IEnumerator
override this.GetEnumerator : unit -> System.Collections.IEnumerator
Public Function GetEnumerator () As IEnumerator
Объект IEnumerator, обеспечивающий динамическое подключение к сообщениям очереди.
- Атрибуты
В следующем коде показано использование функции GetEnumerator.
// Connect to a queue on the local computer.
MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue");
// Get an IEnumerator object.
System::Collections::IEnumerator^ enumerator =
queue->GetMessageEnumerator2();
// Use the IEnumerator object to loop through the messages.
while(enumerator->MoveNext())
{
// Get a message from the enumerator.
Message^ msg = (Message^)enumerator->Current;
// Display the label of the message.
Console::WriteLine(msg->Label);
}
queue->Close();
// Connect to a queue on the local computer.
MessageQueue queue = new MessageQueue(".\\exampleQueue");
// Get an IEnumerator object.
System.Collections.IEnumerator enumerator = queue.GetEnumerator();
// Use the IEnumerator object to loop through the messages.
while(enumerator.MoveNext())
{
// Get a message from the enumerator.
Message msg = (Message)enumerator.Current;
// Display the label of the message.
Console.WriteLine(msg.Label);
}
В следующей таблице показано, доступен ли этот метод в различных режимах рабочей группы.
Режим рабочей группы | Доступно |
---|---|
Локальный компьютер | Да |
Имя локального компьютера и прямого формата | Да |
Удаленный компьютер | Нет |
Имя удаленного компьютера и прямого формата | Да |
Продукт | Версии (Устарело) |
---|---|
.NET Framework | 1.1 (2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1) |
Отзыв о .NET
.NET — это проект с открытым исходным кодом. Выберите ссылку, чтобы оставить отзыв: