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

Cursor Class

Note: This class is new in the .NET Framework version 2.0.

A Cursor is used to maintain a specific location in a MessageQueue when reading the queue's messages.

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

public sealed class Cursor : IDisposable
public final class Cursor implements IDisposable
public final class Cursor implements IDisposable

To get a cursor for a MessageQueue, call the CreateCursor method for that queue.

A Cursor is used with such methods as Peek(TimeSpan,Cursor,PeekAction) and Receive(TimeSpan,Cursor) when you need to read messages that are not at the front of the queue. This includes reading messages synchronously or asynchronously. Cursors do not need to be used to read only the first message in a queue.

When reading messages within a transaction, Message Queuing does not roll back cursor movement if the transaction is aborted. For example, suppose there is a queue with two messages, A1 and A2. If you remove message A1 while in a transaction, Message Queuing moves the cursor to message A2. However, if the transaction is aborted for any reason, message A1 is inserted back into the queue but the cursor remains pointing at message A2.

To close the cursor, call M:System.Messaging.Cursor.Close.

System.Object
  System.Messaging.Cursor
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.