andrew4582

NotifyCollectionsActions

Dec 19th, 2012
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1.         class NotifyCollectionsActions
  2.         {
  3.             public readonly INotifyCollectionChanged[] Collections;
  4.             public readonly Action ChangedAction;
  5.  
  6.             public NotifyCollectionsActions(Action changedAction, params INotifyCollectionChanged[] collections)
  7.             {
  8.                 this.Collections = collections;
  9.                 this.ChangedAction = changedAction;
  10.  
  11.                 foreach (INotifyCollectionChanged collection in Collections)
  12.                 {
  13.                     collection.CollectionChanged += (s, e) =>
  14.                     {
  15.                         if (ChangedAction != null)
  16.                             ChangedAction();
  17.                     };
  18.                 }
  19.             }
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment