private void RemoveFilter(string filterType, string filter, ref List <Movie> toRemove) { if (filter != string.Empty) { foreach (Movie m in filteredMovies) { if (!toRemove.Contains(m)) { if (Movie.PropertyIsArray(filterType)) { bool noMatches = true; foreach (string property in m.GetPropertyArray(filterType)) { if (property.ToLower().Contains(filter.ToLower())) { noMatches = false; break; } } if (noMatches) { toRemove.Add(m); } } else { if (!m.GetProperty(filterType).ToLower().Contains(filter.ToLower())) { toRemove.Add(m); } } } } } }
private void AddFilter(string filterType, string filter, ref List <Movie> toAdd) { if (filter != string.Empty) { foreach (Movie m in movies) { if (!filteredMovies.Contains(m) && !toAdd.Contains(m)) { if (Movie.PropertyIsArray(filterType)) { foreach (string property in m.GetPropertyArray(filterType)) { if (property.ToLower().Contains(filter.ToLower())) { toAdd.Add(m); break; } } } else { if (m.GetProperty(filterType).ToLower().Contains(filter.ToLower())) { toAdd.Add(m); } } } } } }