O'Reilly logo

C# Primer: A Practical Approach by Stanley B. Lippman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1.3. Alternative Forms of the Main() Function

In the rest of this chapter we'll explore the predefined elements of the C# language as we implement a small program called WordCount. WordCount opens a user-specified text file and calculates the number of occurrences of each word within the file. The results are sorted in dictionary order and written to an output file. In addition, the program supports two command-line options:

  1. -t causes the program to turn a trace facility on; by default, tracing is off.

  2. -s causes the program to calculate and report the amount of time it takes to read the file, process the words, and write the results; by default, timings are not reported.

Our first task in Main() is to access the command-line arguments passed in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required