Пример #1
0
 void Item_BeforeNameChange(object sender, NameChangeEventArgs e)
 {
     if (e.NewName != e.OldName)
     {
         if (_NameDict.ContainsKey(e.NewName))
         {
             throw new ArgumentException("Cant the the name of the INamedItem from {0} to {1}, because the new name does already exist in a colelction to which this object is assigned.".Build(e.OldName, e.NewName));
         }
     }
 }
Пример #2
0
        void Item_AfterNameChanged(object sender, NameChangeEventArgs e)
        {
            _NameDict.Remove(e.OldName);

            _NameDict.Add(e.NewName, (T)sender);
        }