Exploring more about console apps
We have already created and used basic console apps, but we’re now at a stage where we should delve into them more deeply.
Console apps are text-based and are run at the command prompt. They typically perform simple tasks that need to be scripted, such as compiling a file or encrypting a section of a configuration file.
Equally, they can also have arguments passed to them to control their behavior.
An example of this would be to create a new console app using the F# language with a specified name instead of using the name of the current folder, as shown in the following command:
dotnet new console -lang "F#" --name "ExploringConsole"
Displaying output to the user
The two most common tasks that a console app performs are writing and reading data. We have already used the WriteLine
method to output, but if we didn’t want a carriage return at the end of a line, for example, if we later wanted...