static void Main() { string htmlFileName = @"DifficultWords.txt"; Thread thread = new Thread(() => { WordProcessor wp = new WordProcessor(); wp.ExtractFromFile(htmlFileName); }); thread.Start(); }
static void Main() { string htmlFileName = @"DifficultWords.txt"; Task <IEnumerable <string> > task = Task.Run(() => { WordProcessor wp = new WordProcessor(); return(wp.ExtractFromFile(htmlFileName)); }); Console.WriteLine("Waiting for results to be completed..."); foreach (string word in task.Result) { Console.WriteLine(word); } }