Cursor Cursor Cursor Cursor Class

定義

讀取佇列的訊息時,會使用 Cursor 保持 MessageQueue 中的特定位置。A Cursor is used to maintain a specific location in a MessageQueue when reading the queue's messages.

public ref class Cursor sealed : IDisposable
public sealed class Cursor : IDisposable
type Cursor = class
    interface IDisposable
Public NotInheritable Class Cursor
Implements IDisposable
繼承
CursorCursorCursorCursor
實作

備註

若要取得的資料指標MessageQueue, 請呼叫CreateCursor該佇列的方法。To get a cursor for a MessageQueue, call the CreateCursor method for that queue.

當您需要讀取不在佇列Peek(TimeSpan, Cursor, PeekAction)前端Receive(TimeSpan, Cursor)的訊息時,會與這類方法搭配使用。CursorA 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. 例如, 假設有一個佇列有兩個訊息: A1 和 A2。For example, suppose there is a queue with two messages, A1 and A2. 如果您在交易中移除訊息 A1, 則訊息佇列會將資料指標移至訊息 A2。If you remove message A1 while in a transaction, Message Queuing moves the cursor to message A2. 不過, 如果因為任何原因而中止交易, 則會將訊息 A1 插入佇列中, 但是游標仍會指向訊息 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.

若要關閉資料指標, Close請呼叫。To close the cursor, call Close.

方法

Close() Close() Close() Close()

關閉游標,讓 Message Queuing 釋放相關聯的資源。Closes the cursor, allowing Message Queuing to release the associated resources.

Dispose() Dispose() Dispose() Dispose()

釋放 Cursor 所使用的所有資源。Releases all resources used by the Cursor.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize() Finalize() Finalize() Finalize()
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於

另請參閱