Assembly: System.ServiceModel (in system.servicemodel.dll)
The Timespan specifies the maximum interval of time to wait for a message to arrive before timing out.
Return Valuetrue if a message has arrived before the timeout has been exceeded; otherwise false.
Calling WaitForMessage does not result in a message being received or processed in any other way.
The WaitForMessage method exists primarily for transacted scenarios where the user wants to receive the message using a transaction. When using just Receive normally for this, the user must create the transaction and then call Receive and hope the message arrives before the transaction times out, which may not be possible.
Instead, the user can call WaitForMessage with whatever time out they want (even infinite), then when a message arrives they can open the transaction, call Receive and be confident that they can get the message back before the transaction expires.
This method is synchronous, so it blocks the current thread until a message is available or the time out occurs. Use WaitForMessage when it is acceptable for the current thread to be blocked while it waits for a message to arrive in the queue. The thread is blocked up to the specified timeout. If you need the application processing to continue without waiting, use the asynchronous BeginWaitForMessage method.Notes to Implementers: The operation returns false if the specified timeout is exceeded, not a timeout exception.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.