Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why using tabs with Console.WriteLine don't show background color?

When you print tabs using Console.WriteLine, they never use the specified background color:

Console.BackgroundColor = ConsoleColor.Red;
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("No tabs, no spaces");
Console.WriteLine("\tTabs don't have background color");
Console.WriteLine("    Spaces have background color");

enter image description here

Did I miss something or is it by design?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

After some testing it looks like this is related to how the native Visual Studio debugger renders the output and is not by fault of your code or app.

e.g. See below a side by side running a sample through the debugger vs directly through command line.

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading