Example #1
0
        public void DeleteWordsByLength(int length)
        {
            var _words = sentences.SelectMany(x => x.Words).
                         Where(x => x.Length == length && x[0].IsVowel == false).Distinct();

            for (int i = 0; i < sentences.Count; i++)
            {
                ISentence sentence = sentences[i];
                for (int j = 0; j < _words.Count(); j++)
                {
                    while (_words.Count() != 0 && sentence.Contains(_words.ToArray()[j]))
                    {
                        int spaceIndex = sentence.ToList().IndexOf(_words.ToArray()[j]) - 1;
                        sentence.Remove(_words.ToArray()[j]);
                        sentence.RemoveAtIndex(spaceIndex);
                    }
                }
            }
        }