Example #1
0
 protected override void OnSet(object key, object oldValue, object newValue)
 {
     if (oldValue == null && !NameIndexList.Contains(key))
     {
         OnInsert(key, newValue);
     }
 }
Example #2
0
        protected override void OnSet(object key, object oldValue, object newValue)
        {
            //
            // NOTE: OnSet is called when the base dictionary is modified via
            // the indexer. We need to trap this and detect when a new key is
            // being added via the indexer. If the old value is null for the
            // key, then there is a big chance it is a new key. But just to be
            // sure, we also check out key index if it does not already exist.
            // Finally, we just delegate to OnInsert. In effect, we're
            // converting OnSet to OnInsert where needed. Ideally, the base
            // implementation would have done this for.
            //

            if (oldValue == null && !NameIndexList.Contains(key))
            {
                OnInsert(key, newValue);
            }
        }