Exemple #1
0
            public void Unlisten()
            {
                foreach (IWeakListener l in this.listeners)
                {
                    l.Unlisten();
                }

                lock (StreamsByIdLock)
                {
                    StreamsById.Remove(this.streamId);
                }
            }
            public void Unlisten()
            {
                foreach (IWeakListener l in this.listeners)
                {
                    l.Unlisten();
                }

                lock (StreamsByIdLock)
                {
                    StreamsById.Remove(this.streamId);
                    // Dictionary does not reclaim space after items are removed, so we will create a new one if we can reclaim a substantial amount of space
                    if (StreamsByIdCapacity > 100 && StreamsById.Count < StreamsByIdCapacity / 2)
                    {
                        StreamsById         = new Dictionary <Guid, StreamListeners>(StreamsById);
                        StreamsByIdCapacity = StreamsById.Count;
                    }
                }
            }