Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

MessageEnumerator.RemoveCurrent Method (MessageQueueTransaction)

Removes the current message from a transactional queue and returns the message to the calling application. There is no timeout specified for a message to arrive in the queue.

Namespace:  System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)
public Message RemoveCurrent(
	MessageQueueTransaction transaction


Type: System.Messaging.MessageQueueTransaction

The MessageQueueTransaction object that specifies the transaction in which the message will be removed.

Return Value

Type: System.Messaging.Message
A Message that references the first message available in the queue.

The transaction parameter is null.

RemoveCurrent removes and returns the message at the cursor's current location, using the internal transaction context defined by the transaction parameter.

If you are using queue journaling, removing the message causes a copy to be kept in the journal queue, just as the MessageQueue class's Receive method does.

When working with transactional queues, a rollback of a transaction causes any messages removed by a call to RemoveCurrent to be returned to the queue. The removal is not irreversible until the transaction is committed.

When you remove the current message, the cursor is moved to the next message. You do not have to call MoveNext after calling RemoveCurrent.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.