Exemplo n.º 1
0
        /// <summary>
        /// 通知观察者合集即将进行清空;
        /// </summary>
        private void NotifyClear()
        {
            DictionaryEvent <TKey, TValue> dictionaryEvent = new DictionaryEvent <TKey, TValue>()
            {
                Dictionary = this,
                EventType  = DictionaryEventType.Clear,
            };

            observers.NotifyNext(dictionaryEvent);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 通知观察者合集即将进行加入操作;
        /// </summary>
        private void NotifyRemove(TKey key, TValue originalValue)
        {
            DictionaryEvent <TKey, TValue> dictionaryEvent = new DictionaryEvent <TKey, TValue>()
            {
                Dictionary    = this,
                EventType     = DictionaryEventType.Remove,
                Key           = key,
                OriginalValue = originalValue,
            };

            observers.NotifyNext(dictionaryEvent);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 通知观察者合集即将进行加入操作;
        /// </summary>
        private void NotifyAdd(TKey key, TValue newValue)
        {
            DictionaryEvent <TKey, TValue> dictionaryEvent = new DictionaryEvent <TKey, TValue>()
            {
                Dictionary = this,
                EventType  = DictionaryEventType.Add,
                Key        = key,
                NewValue   = newValue,
            };

            observers.NotifyNext(dictionaryEvent);
        }