This documentation is archived and is not being maintained.

MessageEnumerator.Current Property

Gets the current Message that this enumerator points to.

[Visual Basic]
Public ReadOnly Property Current As Message
public Message Current {get;}
public: __property Message* get_Current();
public function get Current() : Message;

Property Value

The current message.


Exception Type Condition
InvalidOperationException You called Current before the first call to MoveNext. The cursor is located before the first element of the message enumeration.


You called Current after a call to MoveNext had returned false (indicating the cursor is located after the last element of the message enumeration.)

MessageQueueException The message the enumerator is currently pointing to no longer exists. It might have been deleted.


When the enumerator is created, it points to the head of the queue, at a location before the first message. In this case, Current is not valid and will throw an exception if it is accessed. You must call MoveNext to position the cursor at the first message in the queue.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

MessageEnumerator Class | MessageEnumerator Members | System.Messaging Namespace | MoveNext | Reset | MessageQueue.GetMessageEnumerator