Working with the System.Console class
You may have noticed that in all our examples up to this point, we have used the Console
class. More specifically, we only used one of its methods (namely WriteLine
). This method displays the value of the expression passed as a parameter, and then gets to the next line. If we don’t want to get to the next line, we can use the Write
method instead.
However, the Console
class provides other useful properties and methods. We won’t go into the details of all of them (for that matter, I’d recommend that you visit https://learn.microsoft.com/en-us/dotnet/api/system.console). Instead, I’ll highlight the most interesting ones when it comes to console applications.
Useful properties
There are three properties I would like to tell you about in particular: BackgroundColor
, ForegroundColor
, and Title
.
The first two, as their names suggest, are used to alter the background and foreground color of the terminal.
The...