///<summary> ///</summary> ///<param name="initialCollection"></param> ///<param name="resultCollection"></param> private void FilterItems(IEnumerable <InitialOrder> initialCollection, ICommonCollection <InitialOrder> resultCollection) { if (_filter == null || _filter.All(i => i.Values.Length == 0)) { resultCollection.Clear(); resultCollection.AddRange(initialCollection); return; } resultCollection.Clear(); foreach (var pd in initialCollection) { if (_filter.FilterTypeAnd) { bool acceptable = true; foreach (ICommonFilter filter in _filter) { acceptable = filter.Acceptable(pd); if (!acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } else { bool acceptable = true; foreach (ICommonFilter filter in _filter) { if (filter.Values == null || filter.Values.Length == 0) { continue; } acceptable = filter.Acceptable(pd); if (acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } } }