PeekCompletedEventArgs.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Messaging / System / Messaging / PeekCompletedEventArgs.cs / 1305376 / PeekCompletedEventArgs.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Messaging { 
 
    using System.Diagnostics;
 
    using System;

    /// 
    ///  
    /// Provides data for the  event. When your asynchronous
    ///    operation calls an event handler, an instance of this class is passed to the 
    ///    handler. 
    /// 
    public class PeekCompletedEventArgs : EventArgs { 
        private IAsyncResult result;
        private Message message;
        private MessageQueue sender;
 
        /// 
        ///  
        internal PeekCompletedEventArgs(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 peek
        ///       operation.
        ///  
        public Message  Message {
            get { 
                if (this.message == null) { 
                    try {
                        this.message = this.sender.EndPeek(result); 
                    }
                    catch {
                        throw;
                    } 
                }
 
                return this.message; 
            }
        } 
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Messaging { 
 
    using System.Diagnostics;
 
    using System;

    /// 
    ///  
    /// Provides data for the  event. When your asynchronous
    ///    operation calls an event handler, an instance of this class is passed to the 
    ///    handler. 
    /// 
    public class PeekCompletedEventArgs : EventArgs { 
        private IAsyncResult result;
        private Message message;
        private MessageQueue sender;
 
        /// 
        ///  
        internal PeekCompletedEventArgs(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 peek
        ///       operation.
        ///  
        public Message  Message {
            get { 
                if (this.message == null) { 
                    try {
                        this.message = this.sender.EndPeek(result); 
                    }
                    catch {
                        throw;
                    } 
                }
 
                return this.message; 
            }
        } 
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK