CSharp examples for System.Collections.ObjectModel:ObservableCollection
Remove All from ObservableCollection by predicate
using System.Threading.Tasks; using System.Text; using System.Linq; using System.ComponentModel; using System.Collections.Specialized; using System.Collections.ObjectModel; using System.Collections.Generic; using System.Collections; using System;//from ww w. j a v a 2 s . co m public class Main{ public static void RemoveAll<T>( this ObservableCollection<T> list, Func<T,bool> match ) where T:class { var removeItem = list.With(x => list) .With(x => list.FirstOrDefault(match)); if (removeItem != null) list.Remove(removeItem); } }