MessageEnumerator.MoveNext Method

Definition

Advances the enumerator to the next message in the queue.

Overloads

MoveNext()

Advances the enumerator to the next message in the queue, if one is currently available.

MoveNext(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.

MoveNext()

Advances the enumerator to the next message in the queue, if one is currently available.

public:
 virtual bool MoveNext();
public bool MoveNext ();
abstract member MoveNext : unit -> bool
override this.MoveNext : unit -> bool
Public Function MoveNext () As Boolean

Returns

true if the enumerator was successfully advanced to the next message; false if the enumerator has reached the end of the queue.

Implements

Exceptions

An exception specific to Message Queuing was thrown.

Remarks

This overload returns immediately if there is no message in the queue. There is another overload that waits a specified TimeSpan for a message to arrive.

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 returns false to the calling method.

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

See also

MoveNext(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.

public:
 bool MoveNext(TimeSpan timeout);
public bool MoveNext (TimeSpan timeout);
member this.MoveNext : TimeSpan -> bool
Public Function MoveNext (timeout As TimeSpan) As Boolean

Parameters

timeout
TimeSpan

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

Returns

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.

Exceptions

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

An exception specific to Message Queuing was thrown.

-or-

The timeout has expired.

Remarks

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.

See also

Applies to