示例#1
0
        /// <summary>
        /// update the lookups with the new item
        /// 5. dettach notifier from event handler
        /// 4. remove from item -> key dictionary
        /// 3. remove from key-> items lookup
        /// 2. remove from item -> notifier dictionary
        /// 1. dispose notifier
        /// </summary>
        void _removeItemFromLookups(object item)
        {
            var key      = _itemToKey[item];
            var notifier = _itemToNotifier[item];

            notifier.Changed -= Notifier_Changed;
            _itemToKey.Remove(item);
            _keyToItems.Remove(key, item);
            _itemToNotifier.Remove(item);
            notifier.Dispose();
        }
示例#2
0
 public T this[int index]
 {
     get
     {
         var node = _tree[index];
         return(node.Item);
     }
     set
     {
         var node   = _tree[index];
         var oldVal = node.Item;
         _nodes.Remove(oldVal, node);
         node.Item = value;
         _nodes.Add(node.Item, node);
     }
 }