//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //------------------------------------------------------------------------------ using System; namespace Experimental.System.Messaging { /// /// /// Provides data for the /// event. /// public class ReceiveCompletedEventArgs : EventArgs { private IAsyncResult result; private Message message; private MessageQueue sender; /// /// internal ReceiveCompletedEventArgs(MessageQueue sender, IAsyncResult result) { this.result = result; this.sender = sender; } /// /// /// Contains the result of the asynchronous /// operation requested. /// public IAsyncResult AsyncResult { get { return this.result; } set { this.result = value; } } /// /// /// The end result of the posted asynchronous receive /// operation. /// public Message Message { get { if (this.message == null) { try { this.message = this.sender.EndReceive(result); } catch { throw; } } return this.message; } } } }