private Dictionary<string, bool> GetInCorrectWords(string filePath) { List<string> words = new List<string>(); StringBuilder s = new StringBuilder(); Stopwatch ws = new Stopwatch(); ws.Start(); char[] delimiterChars = { ' ', ',', '.', ':', '\t', '\n', '"', '!' }; if (!string.IsNullOrEmpty(filePath)) { using (StreamReader sr = new StreamReader(filePath)) { String line; while ((line = sr.ReadLine()) != null) { words.AddRange(line.Split(delimiterChars)); } } } ws.Stop(); Console.WriteLine("Time for reading incorrect file - " + ws.ElapsedMilliseconds + "ms"); ws.Restart(); Dictionary<string, bool> inCorrectWords = new Dictionary<string, bool>(); foreach (string word in words) { if (!inCorrectWords.ContainsKey(word) && !this.CheckWord(word)) { inCorrectWords.Add(word, true); } } ws.Stop(); Console.WriteLine("Time for finding incorrect words- " + ws.ElapsedMilliseconds + "ms"); Console.WriteLine("Incorrect words count - " + inCorrectWords.Count()); return inCorrectWords; }