コード例 #1
0
 /// <summary>
 /// Use in place of CollectionChanged Adder
 /// </summary>
 /// <param name="objTag">Tag to associate with added delegate</param>
 /// <param name="funcDelegateToAdd">Delegate to add to CollectionChanged</param>
 /// <returns>True if delegate was successfully added, false if a delegate already exists with the associated tag.</returns>
 public bool AddTaggedCollectionChanged(object objTag, NotifyCollectionChangedEventHandler funcDelegateToAdd)
 {
     if (!_dicTaggedAddedDelegates.TryGetValue(objTag, out HashSet <NotifyCollectionChangedEventHandler> setFuncs))
     {
         setFuncs = new HashSet <NotifyCollectionChangedEventHandler>();
         _dicTaggedAddedDelegates.Add(objTag, setFuncs);
     }
     if (setFuncs.Add(funcDelegateToAdd))
     {
         base.CollectionChanged += funcDelegateToAdd;
         return(true);
     }
     Utils.BreakIfDebug();
     return(false);
 }