private static void Main(string[] args) { var lines = File.ReadAllLines(@"input.txt"); var stopWatch = new Stopwatch(); stopWatch.Start(); var words = new WordList(','); var total = 0; var lineCount = 0; foreach (var line in lines) { { total += line.Length; lineCount++; words.ScanLine(line); } } stopWatch.Stop(); WriteLine($"Execution time: {stopWatch.ElapsedMilliseconds/1000.0} secs"); WriteLine($"Average length ={total/lineCount}"); using (var sw = new StreamWriter(@"output.txt")) { words.DumpWords(sw); sw.Close(); } if (words.Count > 0) { WriteLine($"{words.Count} Words copied from input.txt to output.txt"); } var totalWords = 0; for (var i = 0; i < WordList.WordFrequencies.Count; i++) { if (WordList.WordFrequencies[i] > 0) { WriteLine($"Count of {i} word = {WordList.WordFrequencies[i]}"); totalWords += WordList.WordFrequencies[i]; } } WriteLine($"Total #Words ={totalWords}"); }