ListenerChannelContext.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Activation / ListenerChannelContext.cs / 1 / ListenerChannelContext.cs

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

namespace System.ServiceModel.Activation 
{
    using System; 
    using System.IO; 
    using System.Runtime.Serialization;
    using System.Net.Sockets; 
    using System.ServiceModel.Dispatcher;

    [DataContract]
    class ListenerChannelContext 
    {
        [DataMember] 
        string appKey; 

        [DataMember] 
        int listenerChannelId;

        [DataMember]
        Guid token; 

        internal ListenerChannelContext(string appKey, int listenerChannelId, Guid token) 
        { 
            this.appKey = appKey;
            this.listenerChannelId = listenerChannelId; 
            this.token = token;
        }

        internal string AppKey { get { return appKey; } } 
        internal int ListenerChannelId { get { return listenerChannelId; } }
        internal Guid Token { get { return token; } } 
 
        public static ListenerChannelContext Hydrate(byte[] blob)
        { 
            using (MemoryStream memoryStream = new MemoryStream(blob))
            {
                DataContractSerializer serializer = new DataContractSerializer(typeof(ListenerChannelContext));
                return (ListenerChannelContext)serializer.ReadObject(memoryStream); 
            }
        } 
 
        public byte[] Dehydrate()
        { 
            using (MemoryStream memoryStream = new MemoryStream())
            {
                DataContractSerializer serializer = new DataContractSerializer(typeof(ListenerChannelContext));
                serializer.WriteObject(memoryStream, this); 
                return memoryStream.ToArray();
            } 
        } 
    }
} 

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

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