Cursor Class
Collapse the table of content
Expand the table of content

Cursor Class

 

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)

System.Object
  System.Messaging.Cursor

[<Sealed>]
type Cursor = 
    class
        interface IDisposable
    end

NameDescription
System_CAPS_pubmethodClose()

Closes the cursor, allowing Message Queuing to release the associated resources.

System_CAPS_pubmethodDispose()

Releases all resources used by the Cursor.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

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

.NET Framework
Available since 2.0

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

Return to top
Show:
© 2016 Microsoft