Advertisement
Guest User

Extension.cs

a guest
Jan 2nd, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.41 KB | None | 0 0
  1.     public static class ExtensionMethods
  2.     {
  3.         public static int RemoveAll<T>(this ObservableCollection<T> coll, Func<T, bool> condition)
  4.         {
  5.             var itemsToRemove = coll.Where(condition).ToList();
  6.  
  7.             foreach (var itemToRemove in itemsToRemove)
  8.             {
  9.                 coll.Remove(itemToRemove);
  10.             }
  11.  
  12.             return itemsToRemove.Count;
  13.         }
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement