public bool IsFiltered(Func <TFilter, bool> predicate) { if ((!IncludeFilters.Any() || IncludeFilters.Any(predicate)) && !ExcludeFilters.Any(predicate)) { return(false); } ++Count; return(true); }
/// <summary> /// Applies the filters to the a given source list /// </summary> /// <param name="sourceList">The source list</param> public IList <TItem> ApplyFilters(IList <TItem> sourceList) { IList <TItem> result = IncludeFilters.Any() ? sourceList.Where(a => IncludeFilters.All(f => f.Invoke(a))) .Except(sourceList.Where(a => ExcludeFilters.Any(f => f.Invoke(a)))) .ToList() : new List <TItem>(); return(result .Concat(IncludedItems) .Except(ExcludedItems) .ToList()); }
protected internal bool IsExcluded(string variableName) { if (IncludeFilters != null) { if (!IncludeFilters.Any(name => IsMatch(name, variableName))) { return(true); } } if (ExcludeFilters != null) { if (ExcludeFilters.Any(name => IsMatch(name, variableName))) { return(true); } } return(false); }