While working on console applications in .net, its nice to display
different colored fonts for different statuses.
For example: Warnings should show up in yellow, errors in
red, success messages in fluorescent green.
This is particularly useful when you write Logger modules
for your products.
#1 Change Foreground Color
1. Console.ForegroundColor = ConsoleColor.Green;
2. Console.WriteLine($"Update successful!");
3.
4. Console.ForegroundColor = ConsoleColor.Red;
5. Console.WriteLine($"There was an error: Invalid input");
6.
7. Console.ForegroundColor = ConsoleColor.Yellow;
8. Console.WriteLine($"Please use Pascal naming conventions");
9.
No comments:
Post a Comment