For as long as I've been writing console applications, I've at
the end of
Main I've always had a piece of code to require
user input before exiting when in debug mode, in order to review
any output before the window closes. Not an onerous task, but
one I immediately do as soon as creating a new application.
Today I created a new .NET Core console application in Visual Studio 2019 preview and added by code without a second thought.
When I ran the application I was in for two surprises - the first was the icon had changed, to a fetching purple. The second was, after the program had ran and displayed my usual "(Press any key to exit.)" message, the console stayed open - with another message to press a key to exit.
A small change, but a welcome one! And, just in case it's not to everyone's liking, there's even an option to disable the behaviour if you don't like it.
Always a catch
Unfortunately, this new option doesn't seem to work for old school console applications using the full .NET Framework, so I'll continue adding my boilerplate blocks to any new .NET Framework console applications I create.
- 2019-03-02 - First published
- 2020-11-22 - Updated formatting