public IEnumerable <string> FilterContent(IEnumerable <string> wordList, UserFilters userFilters)
            {
                if (string.IsNullOrEmpty(userFilters.InputAnagram) || wordList == null)
                {
                    return(wordList);
                }

                List <string> result      = new List <string>();
                var           listOfChars = string.Concat(userFilters.InputAnagram.ToCharArray().OrderBy(input => input));

                foreach (var word in wordList)
                {
                    if (string.IsNullOrEmpty(word))
                    {
                        continue;
                    }

                    if (string.Equals(string.Concat(word.ToCharArray().OrderBy(input => input)), listOfChars, StringComparison.OrdinalIgnoreCase))
                    {
                        result.Add(word);
                    }
                }

                return(result);
            }
Exemple #2
0
        public IEnumerable <string> Process(IEnumerable <string> input, UserFilters userFilters)
        {
            foreach (var module in _modules)
            {
                input = module.FilterContent(input, userFilters);
            }

            return(input);
        }