Export (0) Print
Expand All

MessageEnumerator.MoveNext Method (TimeSpan)

Advances the enumerator to the next message in the queue. If the enumerator is positioned at the end of the queue, MoveNext waits until a message is available or the given timeout expires.

Namespace: System.Messaging
Assembly: System.Messaging (in system.messaging.dll)

public bool MoveNext (
	TimeSpan timeout
)
public boolean MoveNext (
	TimeSpan timeout
)
public function MoveNext (
	timeout : TimeSpan
) : boolean
Not applicable.

Parameters

timeout

The TimeSpan to wait for a message to be available if the enumerator is positioned at the end of the queue.

Return Value

true if the enumerator successfully advanced to the next message; false if the enumerator has reached the end of the queue and a message does not become available within the time specified by the timeout parameter.

Exception typeCondition

ArgumentException

The value specified for the timeout parameter is invalid. It might represent a negative number.

MessageQueueException

An exception specific to Message Queuing was thrown.

-or-

The timeout has expired.

This overload waits if there is no message in the queue or if the cursor has reached the end of the queue. If a message is not currently available because the queue is empty or because you have moved beyond the last element in the collection, MoveNext waits the specified timeout.

If the cursor is already at the end of the queue, MoveNext only returns true if the new message arrives within the specified time interval, has lower priority than all messages currently in the queue and is placed at the end of the queue. An overload with no parameter returns immediately if no further messages are in the queue.

Upon creation, an enumerator is conceptually positioned before the first message of the enumeration, and the first call to MoveNext brings the first message of the enumeration into view.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft