MessageEnumerator.Current Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the current Message that this enumerator points to.

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

public Message Current { get; }

Property Value

Type: System.Messaging.Message

The current message.

Exception Condition

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.)


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.

.NET Framework
Available since 1.1
Return to top