/// <summary> /// Initializes the new instance. /// </summary> /// <param name="originSet">Origin set to iterate</param> /// <param name="wherePredicate">Predicate used for filtering</param> public ObervableCollectionSubset(IObservableCollection <TElement> originSet, Predicate <TElement> wherePredicate) { _originSet = originSet ?? throw new ArgumentNullException(nameof(originSet)); _wherePredicate = wherePredicate ?? throw new ArgumentNullException(nameof(wherePredicate)); // If the collection has been changed, we need to clear the cache _originSet.AddListener(new CollectionListenerAdapter <TElement>(OnOriginSetChanged)); }