SynchronizedChannelCollection.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 / Dispatcher / SynchronizedChannelCollection.cs / 1 / SynchronizedChannelCollection.cs

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

namespace System.ServiceModel.Dispatcher 
{
    using System; 
    using System.Collections.Generic; 
    using System.ServiceModel.Channels;
 
    class SynchronizedChannelCollection : SynchronizedCollection
        where TChannel : IChannel
    {
        EventHandler onChannelClosed; 
        EventHandler onChannelFaulted;
 
        internal SynchronizedChannelCollection(object syncRoot) 
            : base(syncRoot)
        { 
            this.onChannelClosed = new EventHandler(OnChannelClosed);
            this.onChannelFaulted = new EventHandler(OnChannelFaulted);
        }
 
        void AddingChannel(TChannel channel)
        { 
            channel.Faulted += this.onChannelFaulted; 
            channel.Closed += this.onChannelClosed;
        } 

        void RemovingChannel(TChannel channel)
        {
            channel.Faulted -= this.onChannelFaulted; 
            channel.Closed -= this.onChannelClosed;
        } 
 
        void OnChannelClosed(object sender, EventArgs args)
        { 
            TChannel channel = (TChannel)sender;
            this.Remove(channel);
        }
 
        void OnChannelFaulted(object sender, EventArgs args)
        { 
            TChannel channel = (TChannel)sender; 
            this.Remove(channel);
        } 

        protected override void ClearItems()
        {
            List items = this.Items; 

            for (int i=0; i

                        

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