July 2019
Intermediate to advanced
410 pages
10h 32m
English
To illustrate our first pattern, let's walk through the development of the help command and the initial console application. The initial version of the console application is shown as follows:
private static void Main(string[] args){ Greeting(); // note: inline out variable introduced as part of C# 7.0 GetCommand("?").RunCommand(out bool shouldQuit); while (!shouldQuit) { // handle the commands ... } Console.WriteLine("CatalogService has completed."); }
When the application starts, both a greeting and the result of a help command are shown. The application will then process entered commands until the quit command is entered.
The following shows the detail of handling commands:
while (!shouldQuit) { Console.WriteLine(" ...Read now
Unlock full access