示例#1
0
        static void Main()
        {
            string htmlFileName = @"DifficultWords.txt";

            Thread thread = new Thread(() =>
            {
                WordProcessor wp = new WordProcessor();
                wp.ExtractFromFile(htmlFileName);
            });

            thread.Start();
        }
示例#2
0
        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);
            }
        }