This documentation is archived and is not being maintained.

MessageQueue.Receive Method (TimeSpan, Cursor)

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

Receives the current message in the queue, using a specified cursor. If no message is available, this method waits until either a message is available, or the time-out expires.

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

public Message Receive (
	TimeSpan timeout,
	Cursor cursor
)
public Message Receive (
	TimeSpan timeout, 
	Cursor cursor
)
public function Receive (
	timeout : TimeSpan, 
	cursor : Cursor
) : Message

Parameters

timeout

A TimeSpan that indicates the time to wait until a new message is available for inspection.

cursor

A Cursor that maintains a specific position in the message queue.

Return Value

A Message that references the first message available in the queue.

Exception typeCondition

ArgumentException

The value specified for the timeout parameter is not valid, possibly timeout is less than TimeSpan.Zero or greater than MessageQueue.InfiniteTimeout.

MessageQueueException

A message did not arrive in the queue before the time-out expired.

-or-

An error occurred when accessing a Message Queuing method

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

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
Show: